home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1995-04-09 | 20.9 KB | [TEXT/MMCC] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| Compact Compressed (Unix) (archive/compact)
| ext
| Supported |
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary II, Sun Apr 9 16:17:03 1995, modified Sun Apr 9 16:17:03 1995, creator 'MMCC', type ASCII, 19442 bytes "GDTestClut.c" , at 0x4c72 1738 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [MMCC] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0c 47 44 54 65 73 74 | 43 6c 75 74 2e 63 00 00 |..GDTest|Clut.c..|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 4d 43 | 43 00 00 00 00 00 00 00 |.TEXTMMC|C.......|
|00000050| 00 00 00 00 00 4b f2 00 | 00 06 ca ab ad f1 3f ab |.....K..|......?.|
|00000060| ad f1 3f 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..?.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 61 65 00 00 |........|....ae..|
|00000080| 2f 2a 0d 47 44 54 65 73 | 74 43 6c 75 74 2e 63 0d |/*.GDTes|tClut.c.|
|00000090| 0d 54 68 69 73 20 69 73 | 20 75 73 65 64 20 62 79 |.This is| used by|
|000000a0| 20 54 69 6d 65 56 69 64 | 65 6f 3b 20 49 20 63 61 | TimeVid|eo; I ca|
|000000b0| 6e d5 74 20 74 68 69 6e | 6b 20 6f 66 20 61 6e 79 |n.t thin|k of any|
|000000c0| 20 72 65 61 73 6f 6e 20 | 66 6f 72 20 69 6e 63 6c | reason |for incl|
|000000d0| 75 64 69 6e 67 20 69 74 | 20 69 6e 20 61 6e 79 0d |uding it| in any.|
|000000e0| 6f 74 68 65 72 20 70 72 | 6f 67 72 61 6d 2e 0d 0d |other pr|ogram...|
|000000f0| 4f 53 45 72 72 20 47 44 | 54 65 73 74 43 6c 75 74 |OSErr GD|TestClut|
|00000100| 28 46 49 4c 45 20 2a 6f | 5b 32 5d 2c 47 44 48 61 |(FILE *o|[2],GDHa|
|00000110| 6e 64 6c 65 20 64 65 76 | 69 63 65 2c 73 68 6f 72 |ndle dev|ice,shor|
|00000120| 74 20 66 6c 61 67 73 2c | 56 69 64 65 6f 49 6e 66 |t flags,|VideoInf|
|00000130| 6f 20 2a 63 61 72 64 29 | 3b 0d 0d 47 44 54 65 73 |o *card)|;..GDTes|
|00000140| 74 43 6c 75 74 2e 63 20 | 74 65 73 74 73 20 77 68 |tClut.c |tests wh|
|00000150| 65 74 68 65 72 20 74 68 | 65 20 76 69 64 65 6f 20 |ether th|e video |
|00000160| 63 6c 75 74 20 63 61 6e | 20 62 65 20 77 72 69 74 |clut can| be writ|
|00000170| 74 65 6e 20 61 6e 64 20 | 72 65 61 64 20 66 61 69 |ten and |read fai|
|00000180| 74 68 66 75 6c 6c 79 2c | 0d 61 6e 64 20 73 61 76 |thfully,|.and sav|
|00000190| 65 73 20 74 68 65 20 72 | 65 73 75 6c 74 73 20 69 |es the r|esults i|
|000001a0| 6e 20 61 20 75 73 65 72 | 2d 73 75 70 70 6c 69 65 |n a user|-supplie|
|000001b0| 64 20 56 69 64 65 6f 49 | 6e 66 6f 20 73 74 72 75 |d VideoI|nfo stru|
|000001c0| 63 74 75 72 65 2e 20 54 | 68 65 20 74 65 73 74 20 |cture. T|he test |
|000001d0| 63 6f 6e 73 69 73 74 73 | 0d 6f 66 20 77 72 69 74 |consists|.of writ|
|000001e0| 69 6e 67 20 72 61 6e 64 | 6f 6d 20 6e 75 6d 62 65 |ing rand|om numbe|
|000001f0| 72 73 20 74 6f 20 61 6c | 6c 20 74 68 65 20 63 6c |rs to al|l the cl|
|00000200| 75 74 20 65 6e 74 72 69 | 65 73 2c 20 72 65 61 64 |ut entri|es, read|
|00000210| 69 6e 67 20 74 68 65 6d | 20 62 61 63 6b 2c 20 61 |ing them| back, a|
|00000220| 6e 64 0d 63 6f 6d 70 61 | 72 69 6e 67 2e 20 49 d5 |nd.compa|ring. I.|
|00000230| 76 65 20 62 65 65 6e 20 | 73 75 72 70 72 69 73 65 |ve been |surprise|
|00000240| 64 20 74 6f 20 66 69 6e | 64 20 6d 6f 72 65 20 74 |d to fin|d more t|
|00000250| 68 61 6e 20 61 20 66 65 | 77 20 76 69 64 65 6f 20 |han a fe|w video |
|00000260| 64 72 69 76 65 72 73 20 | 74 68 61 74 20 66 61 69 |drivers |that fai|
|00000270| 6c 0d 74 68 69 73 20 74 | 65 73 74 2c 20 66 6f 72 |l.this t|est, for|
|00000280| 20 76 61 72 69 6f 75 73 | 20 72 65 61 73 6f 6e 73 | various| reasons|
|00000290| 2e 0d 0d 54 68 65 20 62 | 69 74 73 20 6f 66 20 d2 |...The b|its of .|
|000002a0| 66 6c 61 67 73 d3 20 61 | 72 65 20 74 65 73 74 65 |flags. a|re teste|
|000002b0| 64 20 69 6e 64 65 70 65 | 6e 64 65 6e 74 6c 79 2e |d indepe|ndently.|
|000002c0| 20 49 66 20 66 6c 61 67 | 73 26 74 65 73 74 43 6c | If flag|s&testCl|
|000002d0| 75 74 51 75 69 63 6b 6c | 79 46 6c 61 67 20 74 68 |utQuickl|yFlag th|
|000002e0| 65 6e 0d 53 65 74 45 6e | 74 72 69 65 73 51 75 69 |en.SetEn|triesQui|
|000002f0| 63 6b 6c 79 28 29 20 77 | 69 6c 6c 20 62 65 20 74 |ckly() w|ill be t|
|00000300| 65 73 74 65 64 20 69 6e | 73 74 65 61 64 20 6f 66 |ested in|stead of|
|00000310| 20 47 44 53 65 74 45 6e | 74 72 69 65 73 2f 47 44 | GDSetEn|tries/GD|
|00000320| 44 69 72 65 63 74 53 65 | 74 45 6e 74 72 69 65 73 |DirectSe|tEntries|
|00000330| 2e 0d 49 66 20 66 6c 61 | 67 73 26 74 65 73 74 43 |..If fla|gs&testC|
|00000340| 6c 75 74 53 65 72 69 61 | 6c 6c 79 46 6c 61 67 20 |lutSeria|llyFlag |
|00000350| 74 68 65 6e 20 74 68 65 | 20 63 6c 75 74 20 65 6e |then the| clut en|
|00000360| 74 72 69 65 73 20 77 69 | 6c 6c 20 62 65 20 73 65 |tries wi|ll be se|
|00000370| 74 20 69 6e 64 69 76 69 | 64 75 61 6c 6c 79 2c 0d |t indivi|dually,.|
|00000380| 63 61 6c 6c 69 6e 67 20 | 47 44 53 65 74 45 6e 74 |calling |GDSetEnt|
|00000390| 72 69 65 73 20 6f 6e 63 | 65 20 66 6f 72 20 65 61 |ries onc|e for ea|
|000003a0| 63 68 20 63 6c 75 74 20 | 65 6e 74 72 79 2c 20 74 |ch clut |entry, t|
|000003b0| 6f 20 63 68 65 63 6b 20 | 74 68 65 20 63 6c 75 74 |o check |the clut|
|000003c0| 20 65 6e 74 72 79 0d 61 | 64 64 72 65 73 73 69 6e | entry.a|ddressin|
|000003d0| 67 2e 20 49 66 20 66 6c | 61 67 73 26 74 65 73 74 |g. If fl|ags&test|
|000003e0| 43 6c 75 74 4c 69 6e 65 | 61 72 46 6c 61 67 20 74 |ClutLine|arFlag t|
|000003f0| 68 65 6e 20 61 20 73 69 | 6d 70 6c 65 20 73 65 71 |hen a si|mple seq|
|00000400| 75 65 6e 63 65 2c 20 77 | 69 6c 6c 20 62 65 20 6c |uence, w|ill be l|
|00000410| 6f 61 64 65 64 0d 69 6e | 74 6f 20 74 68 65 20 63 |oaded.in|to the c|
|00000420| 6c 75 74 2c 20 69 6e 73 | 74 65 61 64 20 6f 66 20 |lut, ins|tead of |
|00000430| 72 61 6e 64 6f 6d 20 6e | 75 6d 62 65 72 73 2c 20 |random n|umbers, |
|00000440| 74 6f 20 68 65 6c 70 20 | 66 69 67 75 72 69 6e 67 |to help |figuring|
|00000450| 20 6f 75 74 20 73 79 73 | 74 65 6d 61 74 69 63 0d | out sys|tematic.|
|00000460| 65 72 72 6f 72 73 2e 20 | 54 68 65 20 73 65 71 75 |errors. |The sequ|
|00000470| 65 6e 63 65 20 69 73 20 | 28 30 2c 30 2c 30 29 2c |ence is |(0,0,0),|
|00000480| 28 31 2c 30 2c 30 29 2c | 20 28 30 2c 32 2c 30 29 |(1,0,0),| (0,2,0)|
|00000490| 2c 28 30 2c 30 2c 33 29 | 2c 28 34 2c 34 2c 34 29 |,(0,0,3)|,(4,4,4)|
|000004a0| 2c 28 34 2c 30 2c 30 29 | 2c 20 61 6e 64 20 73 6f |,(4,0,0)|, and so|
|000004b0| 0d 6f 6e 2e 0d 0d 52 65 | 74 75 72 6e 65 64 20 76 |.on...Re|turned v|
|000004c0| 61 6c 75 65 20 69 73 20 | 7a 65 72 6f 20 69 66 20 |alue is |zero if |
|000004d0| 6f 6b 2c 20 6e 6f 6e 7a | 65 72 6f 20 69 66 20 65 |ok, nonz|ero if e|
|000004e0| 72 72 6f 72 20 6f 63 63 | 75 72 72 65 64 2e 0d 0d |rror occ|urred...|
|000004f0| 47 44 54 65 73 74 43 6c | 75 74 20 72 65 63 6f 67 |GDTestCl|ut recog|
|00000500| 6e 69 7a 65 73 20 74 68 | 65 20 63 6f 6d 6d 6f 6e |nizes th|e common|
|00000510| 20 64 72 69 76 65 72 20 | 65 72 72 6f 72 73 20 61 | driver |errors a|
|00000520| 6e 64 20 72 65 70 6f 72 | 74 73 20 74 68 65 6d 20 |nd repor|ts them |
|00000530| 69 6e 20 61 20 73 65 6e | 73 69 62 6c 65 0d 77 61 |in a sen|sible.wa|
|00000540| 79 2c 20 75 73 69 6e 67 | 20 74 68 65 20 76 61 72 |y, using| the var|
|00000550| 69 6f 75 73 20 66 69 65 | 6c 64 73 20 6f 66 20 74 |ious fie|lds of t|
|00000560| 68 65 20 63 61 72 64 2d | 3e 64 65 70 74 68 5b 64 |he card-|>depth[d|
|00000570| 5d 2e 63 6c 75 74 20 73 | 74 72 75 63 74 75 72 65 |].clut s|tructure|
|00000580| 2e 20 45 72 72 6f 72 73 | 0d 61 63 63 75 6d 75 6c |. Errors|.accumul|
|00000590| 61 74 65 20 69 6e 20 74 | 68 65 20 63 61 72 64 2d |ate in t|he card-|
|000005a0| 3e 64 65 70 74 68 5b 64 | 5d 2e 63 6c 75 74 20 73 |>depth[d|].clut s|
|000005b0| 74 72 75 63 74 75 72 65 | 2c 20 61 6c 6c 6f 77 69 |tructure|, allowi|
|000005c0| 6e 67 20 79 6f 75 20 74 | 6f 20 6d 61 6b 65 20 6d |ng you t|o make m|
|000005d0| 75 6c 74 69 70 6c 65 0d | 63 61 6c 6c 73 20 74 6f |ultiple.|calls to|
|000005e0| 20 47 44 54 65 73 74 43 | 6c 75 74 20 61 6e 64 20 | GDTestC|lut and |
|000005f0| 6f 6e 6c 79 20 74 68 65 | 6e 20 73 75 6d 6d 61 72 |only the|n summar|
|00000600| 69 7a 65 20 74 68 65 20 | 72 65 73 75 6c 74 73 2e |ize the |results.|
|00000610| 20 49 74 20 69 73 20 69 | 6d 70 6f 72 74 61 6e 74 | It is i|mportant|
|00000620| 20 74 68 61 74 0d 79 6f | 75 20 7a 65 72 6f 20 63 | that.yo|u zero c|
|00000630| 61 72 64 2d 3e 64 65 70 | 74 68 5b 64 5d 2e 63 6c |ard->dep|th[d].cl|
|00000640| 75 74 2e 74 65 73 74 73 | 20 61 6e 64 20 63 61 72 |ut.tests| and car|
|00000650| 64 2d 3e 64 65 70 74 68 | 5b 64 5d 2e 63 6c 75 74 |d->depth|[d].clut|
|00000660| 51 75 69 63 6b 6c 79 2e | 74 65 73 74 73 20 62 65 |Quickly.|tests be|
|00000670| 66 6f 72 65 0d 79 6f 75 | 72 20 66 69 72 73 74 20 |fore.you|r first |
|00000680| 63 61 6c 6c 20 74 6f 20 | 47 44 54 65 73 74 43 6c |call to |GDTestCl|
|00000690| 75 74 2c 20 74 6f 20 69 | 6e 64 75 63 65 20 69 74 |ut, to i|nduce it|
|000006a0| 20 74 6f 20 7a 65 72 6f | 20 74 68 65 20 72 65 73 | to zero| the res|
|000006b0| 74 20 6f 66 20 74 68 65 | 20 63 6c 75 74 0d 73 74 |t of the| clut.st|
|000006c0| 72 75 63 74 75 72 65 73 | 2e 0d 0d 41 73 73 75 6d |ructures|...Assum|
|000006d0| 65 73 20 74 68 61 74 20 | 47 44 65 76 69 63 65 20 |es that |GDevice |
|000006e0| 72 65 63 6f 72 64 20 69 | 73 20 76 61 6c 69 64 2c |record i|s valid,|
|000006f0| 20 69 2e 65 2e 20 74 68 | 65 20 75 73 65 72 20 68 | i.e. th|e user h|
|00000700| 61 73 20 6e 6f 74 20 63 | 61 6c 6c 65 64 20 47 44 |as not c|alled GD|
|00000710| 53 65 74 4d 6f 64 65 28 | 29 2e 0d 0d 48 49 53 54 |SetMode(|)...HIST|
|00000720| 4f 52 59 3a 0d 33 2f 39 | 2f 39 33 09 64 67 70 09 |ORY:.3/9|/93.dgp.|
|00000730| 63 6f 64 65 20 65 78 74 | 72 61 63 74 65 64 20 66 |code ext|racted f|
|00000740| 72 6f 6d 20 74 68 65 20 | 64 65 6d 6f 20 54 65 73 |rom the |demo Tes|
|00000750| 74 43 6c 75 74 73 2e 63 | 2c 20 74 6f 20 63 72 65 |tCluts.c|, to cre|
|00000760| 61 74 65 20 61 20 72 65 | 75 73 61 62 6c 65 0d 09 |ate a re|usable..|
|00000770| 09 73 75 62 72 6f 75 74 | 69 6e 65 2e 0d 33 2f 31 |.subrout|ine..3/1|
|00000780| 30 2f 39 33 09 64 67 70 | 09 4e 6f 20 6c 6f 6e 67 |0/93.dgp|.No long|
|00000790| 65 72 20 61 73 73 75 6d | 65 20 74 68 61 74 20 47 |er assum|e that G|
|000007a0| 44 65 76 69 63 65 20 72 | 65 63 6f 72 64 20 72 65 |Device r|ecord re|
|000007b0| 66 6c 65 63 74 73 20 74 | 68 65 20 61 63 74 75 61 |flects t|he actua|
|000007c0| 6c 20 73 74 61 74 65 20 | 6f 66 20 74 68 65 0d 09 |l state |of the..|
|000007d0| 09 64 72 69 76 65 72 2e | 0d 34 2f 35 2f 39 33 09 |.driver.|.4/5/93.|
|000007e0| 64 67 70 09 41 64 64 20 | 73 75 70 70 6f 72 74 20 |dgp.Add |support |
|000007f0| 66 6f 72 20 67 72 61 79 | 42 2e 0d 34 2f 31 39 2f |for gray|B..4/19/|
|00000800| 39 33 09 64 67 70 09 46 | 69 78 65 64 20 62 75 67 |93.dgp.F|ixed bug|
|00000810| 20 69 6e 20 56 69 73 69 | 62 6c 65 48 61 73 68 20 | in Visi|bleHash |
|00000820| 74 68 61 74 20 75 73 65 | 64 20 67 61 72 62 61 67 |that use|d garbag|
|00000830| 65 20 69 6e 20 70 6c 61 | 63 65 20 6f 66 0d 09 09 |e in pla|ce of...|
|00000840| 09 6c 69 6e 65 61 72 20 | 63 6f 6c 6f 72 20 74 61 |.linear |color ta|
|00000850| 62 6c 65 20 77 68 65 6e | 20 67 64 54 79 70 65 3d |ble when| gdType=|
|00000860| 3d 64 69 72 65 63 74 54 | 79 70 65 2e 20 55 73 65 |=directT|ype. Use|
|00000870| 20 47 44 4e 65 77 4c 69 | 6e 65 61 72 43 6f 6c 6f | GDNewLi|nearColo|
|00000880| 72 54 61 62 6c 65 2e 0d | 35 2f 31 31 2f 39 33 09 |rTable..|5/11/93.|
|00000890| 64 67 70 09 47 44 54 65 | 73 74 43 6c 75 74 48 61 |dgp.GDTe|stClutHa|
|000008a0| 73 68 20 6e 6f 77 20 63 | 68 65 63 6b 73 20 66 6f |sh now c|hecks fo|
|000008b0| 72 20 76 61 6c 69 64 20 | 64 65 76 69 63 65 2c 20 |r valid |device, |
|000008c0| 69 6e 20 72 65 73 70 6f | 6e 73 65 20 74 6f 20 62 |in respo|nse to b|
|000008d0| 75 67 20 72 65 70 6f 72 | 74 0d 09 09 09 62 79 20 |ug repor|t....by |
|000008e0| 4a 6f 6e 61 74 68 61 6e | 20 42 72 65 63 68 65 72 |Jonathan| Brecher|
|000008f0| 2e 0d 35 2f 31 38 2f 39 | 33 09 64 67 70 09 41 6c |..5/18/9|3.dgp.Al|
|00000900| 6c 6f 77 20 73 6d 61 6c | 6c 2c 20 30 2e 30 30 31 |low smal|l, 0.001|
|00000910| 2c 20 74 6f 6c 65 72 61 | 6e 63 65 20 69 6e 20 65 |, tolera|nce in e|
|00000920| 73 74 61 62 6c 69 73 68 | 69 6e 67 20 74 68 65 20 |stablish|ing the |
|00000930| 69 64 65 6e 74 69 74 79 | 20 74 72 61 6e 73 66 6f |identity| transfo|
|00000940| 72 6d 2e 0d 35 2f 32 35 | 2f 39 33 09 64 67 70 09 |rm..5/25|/93.dgp.|
|00000950| 49 6e 63 72 65 61 73 65 | 64 20 70 72 6f 70 6f 72 |Increase|d propor|
|00000960| 74 69 6f 6e 20 6f 66 20 | 74 69 6d 65 20 73 70 65 |tion of |time spe|
|00000970| 6e 74 20 6c 6f 61 64 69 | 6e 67 20 63 6c 75 74 20 |nt loadi|ng clut |
|00000980| 69 6e 20 56 69 73 69 62 | 6c 65 48 61 73 68 28 29 |in Visib|leHash()|
|00000990| 2e 0d 39 2f 35 2f 39 34 | 20 64 67 70 20 72 65 6d |..9/5/94| dgp rem|
|000009a0| 6f 76 65 64 20 61 73 73 | 75 6d 70 74 69 6f 6e 20 |oved ass|umption |
|000009b0| 69 6e 20 70 72 69 6e 74 | 66 27 73 20 74 68 61 74 |in print|f's that|
|000009c0| 20 69 6e 74 3d 3d 73 68 | 6f 72 74 2e 0d 31 32 2f | int==sh|ort..12/|
|000009d0| 32 39 2f 39 34 20 64 67 | 70 20 57 72 69 74 65 41 |29/94 dg|p WriteA|
|000009e0| 6e 64 52 65 61 64 43 6c | 75 74 20 6e 6f 77 20 77 |ndReadCl|ut now w|
|000009f0| 61 69 74 73 20 66 6f 72 | 20 76 62 6c 20 62 65 66 |aits for| vbl bef|
|00000a00| 6f 72 65 20 72 65 61 64 | 69 6e 67 2e 0d 34 2f 38 |ore read|ing..4/8|
|00000a10| 2f 39 35 20 64 67 70 20 | 49 20 69 6e 74 72 6f 64 |/95 dgp |I introd|
|00000a20| 75 63 65 64 20 57 41 49 | 54 5f 46 4f 52 5f 56 42 |uced WAI|T_FOR_VB|
|00000a30| 4c 20 74 6f 20 65 6e 61 | 62 6c 65 2f 64 69 73 61 |L to ena|ble/disa|
|00000a40| 62 6c 65 20 77 61 69 74 | 69 6e 67 20 66 6f 72 20 |ble wait|ing for |
|00000a50| 76 62 6c 20 62 65 74 77 | 65 65 6e 20 0d 09 09 09 |vbl betw|een ....|
|00000a60| 77 72 69 74 65 20 61 6e | 64 20 72 65 61 64 20 6f |write an|d read o|
|00000a70| 66 20 43 4c 55 54 2e 20 | 49 20 69 6e 74 72 6f 64 |f CLUT. |I introd|
|00000a80| 75 63 65 20 74 68 65 20 | 77 61 69 74 20 74 6f 20 |uce the |wait to |
|00000a90| 73 65 65 20 69 66 20 69 | 74 20 77 6f 75 6c 64 20 |see if i|t would |
|00000aa0| 0d 09 09 09 68 65 6c 70 | 20 63 65 72 74 61 69 6e |....help| certain|
|00000ab0| 20 76 69 64 65 6f 20 63 | 61 72 64 73 20 70 61 73 | video c|ards pas|
|00000ac0| 73 20 74 68 65 20 74 65 | 73 74 73 2e 20 48 6f 77 |s the te|sts. How|
|00000ad0| 65 76 65 72 2c 20 69 6e | 20 62 6f 74 68 20 63 61 |ever, in| both ca|
|00000ae0| 73 65 73 0d 09 09 09 69 | 74 20 6d 61 64 65 20 6e |ses....i|t made n|
|00000af0| 6f 20 64 69 66 66 65 72 | 65 6e 63 65 20 61 6e 64 |o differ|ence and|
|00000b00| 20 74 68 65 20 65 78 70 | 6c 61 6e 61 74 69 6f 6e | the exp|lanation|
|00000b10| 20 74 75 72 6e 65 64 20 | 6f 75 74 20 74 6f 20 62 | turned |out to b|
|00000b20| 65 20 74 68 61 74 0d 09 | 09 09 63 73 63 53 65 74 |e that..|..cscSet|
|00000b30| 47 61 6d 6d 61 20 77 61 | 73 6e 27 74 20 73 75 70 |Gamma wa|sn't sup|
|00000b40| 70 6f 72 74 65 64 2e 20 | 53 6f 2c 20 69 6e 20 74 |ported. |So, in t|
|00000b50| 68 65 20 69 6e 74 65 72 | 65 73 74 20 6f 66 20 66 |he inter|est of f|
|00000b60| 61 73 74 20 74 65 73 74 | 69 6e 67 2c 0d 09 09 09 |ast test|ing,....|
|00000b70| 49 27 6d 20 6f 6d 69 74 | 74 69 6e 67 20 74 68 65 |I'm omit|ting the|
|00000b80| 20 77 61 69 74 2e 0d 2a | 2f 0d 23 69 6e 63 6c 75 | wait..*|/.#inclu|
|00000b90| 64 65 20 22 56 69 64 65 | 6f 54 6f 6f 6c 62 6f 78 |de "Vide|oToolbox|
|00000ba0| 2e 68 22 0d 23 69 6e 63 | 6c 75 64 65 20 3c 6d 61 |.h".#inc|lude <ma|
|00000bb0| 74 68 2e 68 3e 0d 23 69 | 6e 63 6c 75 64 65 20 3c |th.h>.#i|nclude <|
|00000bc0| 45 72 72 6f 72 73 2e 68 | 3e 0d 23 69 6e 63 6c 75 |Errors.h|>.#inclu|
|00000bd0| 64 65 20 22 47 44 49 6e | 66 6f 2e 68 22 0d 23 64 |de "GDIn|fo.h".#d|
|00000be0| 65 66 69 6e 65 20 57 41 | 49 54 5f 46 4f 52 5f 56 |efine WA|IT_FOR_V|
|00000bf0| 42 4c 20 30 09 2f 2f 20 | 30 20 66 6f 72 20 6e 6f |BL 0.// |0 for no|
|00000c00| 20 77 61 69 74 3b 20 31 | 20 74 6f 20 77 61 69 74 | wait; 1| to wait|
|00000c10| 20 66 6f 72 20 76 62 6c | 20 62 65 74 77 65 65 6e | for vbl| between|
|00000c20| 20 77 72 69 74 65 20 26 | 20 72 65 61 64 20 6f 66 | write &| read of|
|00000c30| 20 43 4c 55 54 2e 0d 0d | 2f 2f 20 54 68 65 73 65 | CLUT...|// These|
|00000c40| 20 66 75 6e 63 74 69 6f | 6e 73 20 61 72 65 20 73 | functio|ns are s|
|00000c50| 6f 6c 65 6c 79 20 66 6f | 72 20 75 73 65 20 77 69 |olely fo|r use wi|
|00000c60| 74 68 69 6e 20 74 68 69 | 73 20 66 69 6c 65 2e 0d |thin thi|s file..|
|00000c70| 43 6f 6c 6f 72 53 70 65 | 63 20 2a 4d 61 6b 65 43 |ColorSpe|c *MakeC|
|00000c80| 6c 75 74 54 61 62 6c 65 | 28 47 44 48 61 6e 64 6c |lutTable|(GDHandl|
|00000c90| 65 20 64 65 76 69 63 65 | 2c 73 68 6f 72 74 20 66 |e device|,short f|
|00000ca0| 6c 61 67 73 29 3b 0d 4f | 53 45 72 72 20 57 72 69 |lags);.O|SErr Wri|
|00000cb0| 74 65 43 6c 75 74 28 47 | 44 48 61 6e 64 6c 65 20 |teClut(G|DHandle |
|00000cc0| 64 65 76 69 63 65 2c 43 | 6f 6c 6f 72 53 70 65 63 |device,C|olorSpec|
|00000cd0| 20 70 75 74 54 61 62 6c | 65 5b 5d 2c 73 68 6f 72 | putTabl|e[],shor|
|00000ce0| 74 20 66 6c 61 67 73 29 | 3b 0d 4f 53 45 72 72 20 |t flags)|;.OSErr |
|00000cf0| 53 68 6f 77 47 61 6d 6d | 61 54 61 62 6c 65 28 46 |ShowGamm|aTable(F|
|00000d00| 49 4c 45 20 2a 6f 5b 32 | 5d 2c 47 44 48 61 6e 64 |ILE *o[2|],GDHand|
|00000d10| 6c 65 20 64 65 76 69 63 | 65 29 3b 0d 76 6f 69 64 |le devic|e);.void|
|00000d20| 20 52 47 42 54 6f 47 72 | 61 79 28 52 47 42 43 6f | RGBToGr|ay(RGBCo|
|00000d30| 6c 6f 72 20 2a 72 67 62 | 2c 73 68 6f 72 74 20 64 |lor *rgb|,short d|
|00000d40| 61 63 53 69 7a 65 29 3b | 0d 42 6f 6f 6c 65 61 6e |acSize);|.Boolean|
|00000d50| 20 55 6e 65 71 75 61 6c | 43 6c 75 74 45 6e 74 72 | Unequal|ClutEntr|
|00000d60| 79 28 52 47 42 43 6f 6c | 6f 72 20 2a 61 2c 52 47 |y(RGBCol|or *a,RG|
|00000d70| 42 43 6f 6c 6f 72 20 2a | 62 2c 73 68 6f 72 74 20 |BColor *|b,short |
|00000d80| 6d 61 73 6b 29 3b 0d 4f | 53 45 72 72 20 56 69 73 |mask);.O|SErr Vis|
|00000d90| 69 62 6c 65 48 61 73 68 | 28 47 44 48 61 6e 64 6c |ibleHash|(GDHandl|
|00000da0| 65 20 64 65 76 69 63 65 | 2c 53 65 74 45 6e 74 72 |e device|,SetEntr|
|00000db0| 69 65 73 46 75 6e 63 74 | 69 6f 6e 20 66 75 6e 63 |iesFunct|ion func|
|00000dc0| 74 69 6f 6e 2c 73 68 6f | 72 74 20 63 6c 75 74 45 |tion,sho|rt clutE|
|00000dd0| 6e 74 72 69 65 73 0d 09 | 2c 73 68 6f 72 74 20 2a |ntries..|,short *|
|00000de0| 68 61 73 68 50 74 72 29 | 3b 0d 76 6f 69 64 20 47 |hashPtr)|;.void G|
|00000df0| 44 52 65 73 74 6f 72 65 | 42 6c 61 63 6b 41 6e 64 |DRestore|BlackAnd|
|00000e00| 57 68 69 74 65 28 47 44 | 48 61 6e 64 6c 65 20 64 |White(GD|Handle d|
|00000e10| 65 76 69 63 65 29 3b 0d | 4f 53 45 72 72 20 45 73 |evice);.|OSErr Es|
|00000e20| 74 69 6d 61 74 65 43 6c | 75 74 54 72 61 6e 73 66 |timateCl|utTransf|
|00000e30| 6f 72 6d 28 73 68 6f 72 | 74 20 66 6c 61 67 73 2c |orm(shor|t flags,|
|00000e40| 56 69 64 65 6f 49 6e 66 | 6f 20 2a 63 61 72 64 29 |VideoInf|o *card)|
|00000e50| 3b 0d 4f 53 45 72 72 20 | 43 6f 6d 70 75 74 65 52 |;.OSErr |ComputeR|
|00000e60| 4d 53 43 6c 75 74 45 72 | 72 6f 72 28 46 49 4c 45 |MSClutEr|ror(FILE|
|00000e70| 20 2a 66 69 6c 65 0d 09 | 2c 43 6f 6c 6f 72 53 70 | *file..|,ColorSp|
|00000e80| 65 63 20 2a 70 75 74 54 | 61 62 6c 65 2c 43 6f 6c |ec *putT|able,Col|
|00000e90| 6f 72 53 70 65 63 20 2a | 67 65 74 54 61 62 6c 65 |orSpec *|getTable|
|00000ea0| 2c 73 68 6f 72 74 20 66 | 6c 61 67 73 2c 56 69 64 |,short f|lags,Vid|
|00000eb0| 65 6f 49 6e 66 6f 20 2a | 63 61 72 64 29 3b 0d 4f |eoInfo *|card);.O|
|00000ec0| 53 45 72 72 20 57 72 69 | 74 65 41 6e 64 52 65 61 |SErr Wri|teAndRea|
|00000ed0| 64 43 6c 75 74 28 47 44 | 48 61 6e 64 6c 65 20 64 |dClut(GD|Handle d|
|00000ee0| 65 76 69 63 65 2c 73 68 | 6f 72 74 20 66 6c 61 67 |evice,sh|ort flag|
|00000ef0| 73 2c 43 6f 6c 6f 72 53 | 70 65 63 20 2a 2a 70 75 |s,ColorS|pec **pu|
|00000f00| 74 2c 43 6f 6c 6f 72 53 | 70 65 63 20 2a 2a 67 65 |t,ColorS|pec **ge|
|00000f10| 74 29 3b 0d 23 64 65 66 | 69 6e 65 20 53 69 78 74 |t);.#def|ine Sixt|
|00000f20| 65 65 6e 42 69 74 47 72 | 61 79 20 31 0d 0d 4f 53 |eenBitGr|ay 1..OS|
|00000f30| 45 72 72 20 47 44 54 65 | 73 74 43 6c 75 74 28 46 |Err GDTe|stClut(F|
|00000f40| 49 4c 45 20 2a 6f 5b 32 | 5d 2c 73 68 6f 72 74 20 |ILE *o[2|],short |
|00000f50| 66 6c 61 67 73 2c 56 69 | 64 65 6f 49 6e 66 6f 20 |flags,Vi|deoInfo |
|00000f60| 2a 63 61 72 64 29 0d 7b | 0d 09 73 68 6f 72 74 20 |*card).{|..short |
|00000f70| 69 2c 6a 2c 63 6c 75 74 | 53 69 7a 65 2c 71 75 69 |i,j,clut|Size,qui|
|00000f80| 63 6b 6c 79 2c 69 73 47 | 72 61 79 3b 0d 09 69 6e |ckly,isG|ray;..in|
|00000f90| 74 20 65 72 72 6f 72 3b | 0d 09 43 6f 6c 6f 72 53 |t error;|..ColorS|
|00000fa0| 70 65 63 20 2a 70 75 74 | 54 61 62 6c 65 3d 4e 55 |pec *put|Table=NU|
|00000fb0| 4c 4c 2c 2a 67 65 74 54 | 61 62 6c 65 3d 4e 55 4c |LL,*getT|able=NUL|
|00000fc0| 4c 3b 0d 09 56 69 64 65 | 6f 43 61 72 64 43 6c 75 |L;..Vide|oCardClu|
|00000fd0| 74 54 65 73 74 20 2a 63 | 6c 75 74 3b 0d 09 0d 09 |tTest *c|lut;....|
|00000fe0| 69 66 28 63 61 72 64 2d | 3e 64 65 76 69 63 65 3d |if(card-|>device=|
|00000ff0| 3d 4e 55 4c 4c 29 72 65 | 74 75 72 6e 20 30 3b 0d |=NULL)re|turn 0;.|
|00001000| 09 69 73 47 72 61 79 3d | 21 54 65 73 74 44 65 76 |.isGray=|!TestDev|
|00001010| 69 63 65 41 74 74 72 69 | 62 75 74 65 28 63 61 72 |iceAttri|bute(car|
|00001020| 64 2d 3e 64 65 76 69 63 | 65 2c 67 64 44 65 76 54 |d->devic|e,gdDevT|
|00001030| 79 70 65 29 3b 0d 09 66 | 6f 72 28 71 75 69 63 6b |ype);..f|or(quick|
|00001040| 6c 79 3d 30 3b 71 75 69 | 63 6b 6c 79 3c 32 3b 71 |ly=0;qui|ckly<2;q|
|00001050| 75 69 63 6b 6c 79 2b 2b | 29 7b 0d 09 09 63 6c 75 |uickly++|){...clu|
|00001060| 74 3d 26 63 61 72 64 2d | 3e 64 65 70 74 68 5b 63 |t=&card-|>depth[c|
|00001070| 61 72 64 2d 3e 64 5d 2e | 63 6c 75 74 5b 71 75 69 |ard->d].|clut[qui|
|00001080| 63 6b 6c 79 5d 5b 69 73 | 47 72 61 79 5d 3b 0d 09 |ckly][is|Gray];..|
|00001090| 09 69 66 28 21 63 6c 75 | 74 2d 3e 72 65 61 64 2e |.if(!clu|t->read.|
|000010a0| 74 65 73 74 65 64 29 7b | 0d 09 09 09 66 6f 72 28 |tested){|....for(|
|000010b0| 6a 3d 30 3b 6a 3c 33 3b | 6a 2b 2b 29 66 6f 72 28 |j=0;j<3;|j++)for(|
|000010c0| 69 3d 30 3b 69 3c 33 3b | 69 2b 2b 29 63 6c 75 74 |i=0;i<3;|i++)clut|
|000010d0| 2d 3e 72 65 61 64 2e 72 | 67 62 47 61 69 6e 5b 6a |->read.r|gbGain[j|
|000010e0| 5d 5b 69 5d 3d 4e 41 4e | 3b 0d 09 09 09 66 6f 72 |][i]=NAN|;....for|
|000010f0| 28 6a 3d 30 3b 6a 3c 33 | 3b 6a 2b 2b 29 63 6c 75 |(j=0;j<3|;j++)clu|
|00001100| 74 2d 3e 72 65 61 64 2e | 72 67 62 45 72 72 6f 72 |t->read.|rgbError|
|00001110| 5b 6a 5d 3d 4e 41 4e 3b | 0d 09 09 09 66 6f 72 28 |[j]=NAN;|....for(|
|00001120| 6a 3d 30 3b 6a 3c 33 3b | 6a 2b 2b 29 63 6c 75 74 |j=0;j<3;|j++)clut|
|00001130| 2d 3e 72 65 61 64 2e 72 | 67 62 45 72 72 6f 72 41 |->read.r|gbErrorA|
|00001140| 74 4f 6e 63 65 5b 6a 5d | 3d 4e 41 4e 3b 0d 09 09 |tOnce[j]|=NAN;...|
|00001150| 09 63 6c 75 74 2d 3e 72 | 65 61 64 2e 65 72 72 6f |.clut->r|ead.erro|
|00001160| 72 73 3d 30 3b 0d 09 09 | 09 63 6c 75 74 2d 3e 72 |rs=0;...|.clut->r|
|00001170| 65 61 64 2e 65 72 72 6f | 72 73 41 74 4f 6e 63 65 |ead.erro|rsAtOnce|
|00001180| 3d 30 3b 0d 09 09 7d 0d | 09 09 69 66 28 21 63 6c |=0;...}.|..if(!cl|
|00001190| 75 74 2d 3e 76 69 73 75 | 61 6c 2e 74 65 73 74 65 |ut->visu|al.teste|
|000011a0| 64 29 7b 0d 09 09 09 63 | 6c 75 74 2d 3e 76 69 73 |d){....c|lut->vis|
|000011b0| 75 61 6c 2e 65 72 72 6f | 72 73 3d 30 3b 0d 09 09 |ual.erro|rs=0;...|
|000011c0| 09 63 6c 75 74 2d 3e 76 | 69 73 75 61 6c 2e 65 72 |.clut->v|isual.er|
|000011d0| 72 6f 72 73 41 74 4f 6e | 63 65 3d 30 3b 0d 09 09 |rorsAtOn|ce=0;...|
|000011e0| 7d 0d 09 09 69 66 28 21 | 63 6c 75 74 2d 3e 68 61 |}...if(!|clut->ha|
|000011f0| 73 68 2e 74 65 73 74 65 | 64 29 7b 0d 09 09 09 63 |sh.teste|d){....c|
|00001200| 6c 75 74 2d 3e 68 61 73 | 68 2e 65 72 72 6f 72 73 |lut->has|h.errors|
|00001210| 3d 30 3b 0d 09 09 7d 0d | 09 7d 0d 09 71 75 69 63 |=0;...}.|.}..quic|
|00001220| 6b 6c 79 3d 28 28 66 6c | 61 67 73 26 74 65 73 74 |kly=((fl|ags&test|
|00001230| 43 6c 75 74 51 75 69 63 | 6b 6c 79 46 6c 61 67 29 |ClutQuic|klyFlag)|
|00001240| 21 3d 30 29 3b 0d 09 63 | 6c 75 74 3d 26 63 61 72 |!=0);..c|lut=&car|
|00001250| 64 2d 3e 64 65 70 74 68 | 5b 63 61 72 64 2d 3e 64 |d->depth|[card->d|
|00001260| 5d 2e 63 6c 75 74 5b 71 | 75 69 63 6b 6c 79 5d 5b |].clut[q|uickly][|
|00001270| 69 73 47 72 61 79 5d 3b | 0d 09 69 66 28 21 63 6c |isGray];|..if(!cl|
|00001280| 75 74 2d 3e 72 65 61 64 | 2e 64 6f 54 65 73 74 29 |ut->read|.doTest)|
|00001290| 72 65 74 75 72 6e 20 30 | 3b 0d 09 0d 09 47 44 49 |return 0|;....GDI|
|000012a0| 6e 66 6f 28 63 61 72 64 | 29 3b 0d 09 69 66 28 63 |nfo(card|);..if(c|
|000012b0| 61 72 64 2d 3e 64 65 76 | 69 63 65 3d 3d 4e 55 4c |ard->dev|ice==NUL|
|000012c0| 4c 29 72 65 74 75 72 6e | 20 30 3b 0d 09 63 6c 75 |L)return| 0;..clu|
|000012d0| 74 53 69 7a 65 3d 63 61 | 72 64 2d 3e 64 65 70 74 |tSize=ca|rd->dept|
|000012e0| 68 5b 63 61 72 64 2d 3e | 64 5d 2e 63 6c 75 74 53 |h[card->|d].clutS|
|000012f0| 69 7a 65 3b 0d 09 65 72 | 72 6f 72 3d 47 44 53 61 |ize;..er|ror=GDSa|
|00001300| 76 65 47 61 6d 6d 61 28 | 63 61 72 64 2d 3e 64 65 |veGamma(|card->de|
|00001310| 76 69 63 65 29 3b 0d 09 | 65 72 72 6f 72 3d 47 44 |vice);..|error=GD|
|00001320| 55 6e 63 6f 72 72 65 63 | 74 65 64 47 61 6d 6d 61 |Uncorrec|tedGamma|
|00001330| 28 63 61 72 64 2d 3e 64 | 65 76 69 63 65 29 3b 0d |(card->d|evice);.|
|00001340| 09 69 66 28 65 72 72 6f | 72 29 72 65 74 75 72 6e |.if(erro|r)return|
|00001350| 20 65 72 72 6f 72 3b 0d | 09 0d 09 65 72 72 6f 72 | error;.|...error|
|00001360| 3d 45 73 74 69 6d 61 74 | 65 43 6c 75 74 54 72 61 |=Estimat|eClutTra|
|00001370| 6e 73 66 6f 72 6d 28 66 | 6c 61 67 73 26 7e 74 65 |nsform(f|lags&~te|
|00001380| 73 74 43 6c 75 74 53 65 | 72 69 61 6c 6c 79 46 6c |stClutSe|riallyFl|
|00001390| 61 67 2c 63 61 72 64 29 | 3b 0d 09 69 66 28 65 72 |ag,card)|;..if(er|
|000013a0| 72 6f 72 29 67 6f 74 6f | 20 64 6f 6e 65 3b 0d 0d |ror)goto| done;..|
|000013b0| 09 65 72 72 6f 72 3d 57 | 72 69 74 65 41 6e 64 52 |.error=W|riteAndR|
|000013c0| 65 61 64 43 6c 75 74 28 | 63 61 72 64 2d 3e 64 65 |eadClut(|card->de|
|000013d0| 76 69 63 65 2c 66 6c 61 | 67 73 2c 26 70 75 74 54 |vice,fla|gs,&putT|
|000013e0| 61 62 6c 65 2c 26 67 65 | 74 54 61 62 6c 65 29 3b |able,&ge|tTable);|
|000013f0| 0d 09 69 66 28 65 72 72 | 6f 72 29 67 6f 74 6f 20 |..if(err|or)goto |
|00001400| 64 6f 6e 65 3b 0d 0d 09 | 2f 2f 20 43 4f 4d 50 41 |done;...|// COMPA|
|00001410| 52 45 0d 09 43 6f 6d 70 | 75 74 65 52 4d 53 43 6c |RE..Comp|uteRMSCl|
|00001420| 75 74 45 72 72 6f 72 28 | 6f 5b 31 5d 2c 70 75 74 |utError(|o[1],put|
|00001430| 54 61 62 6c 65 2c 67 65 | 74 54 61 62 6c 65 2c 66 |Table,ge|tTable,f|
|00001440| 6c 61 67 73 2c 63 61 72 | 64 29 3b 0d 09 63 61 72 |lags,car|d);..car|
|00001450| 64 2d 3e 63 6c 75 74 54 | 65 73 74 65 64 3d 31 3b |d->clutT|ested=1;|
|00001460| 0d 09 0d 09 64 6f 6e 65 | 3a 0d 09 44 69 73 70 6f |....done|:..Dispo|
|00001470| 73 65 50 74 72 28 28 50 | 74 72 29 70 75 74 54 61 |sePtr((P|tr)putTa|
|00001480| 62 6c 65 29 3b 0d 09 44 | 69 73 70 6f 73 65 50 74 |ble);..D|isposePt|
|00001490| 72 28 28 50 74 72 29 67 | 65 74 54 61 62 6c 65 29 |r((Ptr)g|etTable)|
|000014a0| 3b 0d 09 47 44 52 65 73 | 74 6f 72 65 47 61 6d 6d |;..GDRes|toreGamm|
|000014b0| 61 28 63 61 72 64 2d 3e | 64 65 76 69 63 65 29 3b |a(card->|device);|
|000014c0| 0d 09 47 44 52 65 73 74 | 6f 72 65 44 65 76 69 63 |..GDRest|oreDevic|
|000014d0| 65 43 6c 75 74 28 63 61 | 72 64 2d 3e 64 65 76 69 |eClut(ca|rd->devi|
|000014e0| 63 65 29 3b 0d 0d 2f 2f | 09 63 6c 75 74 2d 3e 76 |ce);..//|.clut->v|
|000014f0| 69 73 75 61 6c 2e 64 6f | 54 65 73 74 20 7c 3d 20 |isual.do|Test |= |
|00001500| 65 72 72 6f 72 20 26 26 | 20 63 6c 75 74 2d 3e 68 |error &&| clut->h|
|00001510| 61 73 68 2e 64 6f 54 65 | 73 74 3b 0d 2f 2f 09 69 |ash.doTe|st;.//.i|
|00001520| 66 28 63 6c 75 74 2d 3e | 76 69 73 75 61 6c 2e 64 |f(clut->|visual.d|
|00001530| 6f 54 65 73 74 29 65 72 | 72 6f 72 3d 47 44 54 65 |oTest)er|ror=GDTe|
|00001540| 73 74 43 6c 75 74 56 69 | 73 75 61 6c 6c 79 28 66 |stClutVi|sually(f|
|00001550| 6c 61 67 73 2c 63 61 72 | 64 29 3b 0d 09 72 65 74 |lags,car|d);..ret|
|00001560| 75 72 6e 20 65 72 72 6f | 72 3b 0d 7d 0d 0d 4f 53 |urn erro|r;.}..OS|
|00001570| 45 72 72 20 45 73 74 69 | 6d 61 74 65 43 6c 75 74 |Err Esti|mateClut|
|00001580| 54 72 61 6e 73 66 6f 72 | 6d 28 73 68 6f 72 74 20 |Transfor|m(short |
|00001590| 66 6c 61 67 73 2c 56 69 | 64 65 6f 49 6e 66 6f 20 |flags,Vi|deoInfo |
|000015a0| 2a 63 61 72 64 29 0d 7b | 0d 09 73 68 6f 72 74 20 |*card).{|..short |
|000015b0| 69 2c 6a 2c 74 61 62 6c | 65 53 69 7a 65 2c 71 75 |i,j,tabl|eSize,qu|
|000015c0| 69 63 6b 6c 79 2c 69 73 | 47 72 61 79 3b 0d 09 69 |ickly,is|Gray;..i|
|000015d0| 6e 74 20 65 72 72 6f 72 | 3d 30 3b 0d 09 43 6f 6c |nt error|=0;..Col|
|000015e0| 6f 72 53 70 65 63 20 2a | 70 75 74 54 61 62 6c 65 |orSpec *|putTable|
|000015f0| 2c 2a 67 65 74 54 61 62 | 6c 65 3b 0d 09 56 69 64 |,*getTab|le;..Vid|
|00001600| 65 6f 43 61 72 64 43 6c | 75 74 54 65 73 74 20 2a |eoCardCl|utTest *|
|00001610| 63 6c 75 74 3b 0d 09 6c | 6f 6e 67 20 70 75 74 53 |clut;..l|ong putS|
|00001620| 75 6d 5b 33 5d 2c 67 65 | 74 53 75 6d 5b 33 5d 5b |um[3],ge|tSum[3][|
|00001630| 33 5d 3b 0d 09 75 6e 73 | 69 67 6e 65 64 20 73 68 |3];..uns|igned sh|
|00001640| 6f 72 74 20 2a 70 75 74 | 33 2c 2a 67 65 74 33 3b |ort *put|3,*get3;|
|00001650| 0d 09 09 0d 09 65 72 72 | 6f 72 3d 57 72 69 74 65 |.....err|or=Write|
|00001660| 41 6e 64 52 65 61 64 43 | 6c 75 74 28 63 61 72 64 |AndReadC|lut(card|
|00001670| 2d 3e 64 65 76 69 63 65 | 2c 66 6c 61 67 73 7c 74 |->device|,flags|t|
|00001680| 65 73 74 43 6c 75 74 47 | 61 69 6e 73 2c 26 70 75 |estClutG|ains,&pu|
|00001690| 74 54 61 62 6c 65 2c 26 | 67 65 74 54 61 62 6c 65 |tTable,&|getTable|
|000016a0| 29 3b 0d 09 69 66 28 65 | 72 72 6f 72 29 72 65 74 |);..if(e|rror)ret|
|000016b0| 75 72 6e 20 65 72 72 6f | 72 3b 0d 09 74 61 62 6c |urn erro|r;..tabl|
|000016c0| 65 53 69 7a 65 3d 47 65 | 74 50 74 72 53 69 7a 65 |eSize=Ge|tPtrSize|
|000016d0| 28 28 50 74 72 29 70 75 | 74 54 61 62 6c 65 29 2f |((Ptr)pu|tTable)/|
|000016e0| 73 69 7a 65 6f 66 28 70 | 75 74 54 61 62 6c 65 5b |sizeof(p|utTable[|
|000016f0| 30 5d 29 3b 0d 09 0d 09 | 2f 2f 20 45 73 74 69 6d |0]);....|// Estim|
|00001700| 61 74 65 20 74 72 61 6e | 73 66 6f 72 6d 61 74 69 |ate tran|sformati|
|00001710| 6f 6e 0d 09 66 6f 72 28 | 69 3d 30 3b 69 3c 33 3b |on..for(|i=0;i<3;|
|00001720| 69 2b 2b 29 7b 0d 09 09 | 70 75 74 53 75 6d 5b 69 |i++){...|putSum[i|
|00001730| 5d 3d 30 3b 0d 09 09 66 | 6f 72 28 6a 3d 30 3b 6a |]=0;...f|or(j=0;j|
|00001740| 3c 33 3b 6a 2b 2b 29 67 | 65 74 53 75 6d 5b 69 5d |<3;j++)g|etSum[i]|
|00001750| 5b 6a 5d 3d 30 3b 0d 09 | 7d 0d 09 66 6f 72 28 69 |[j]=0;..|}..for(i|
|00001760| 3d 30 3b 69 3c 74 61 62 | 6c 65 53 69 7a 65 3b 69 |=0;i<tab|leSize;i|
|00001770| 2b 2b 29 7b 0d 09 09 70 | 75 74 33 3d 28 75 6e 73 |++){...p|ut3=(uns|
|00001780| 69 67 6e 65 64 20 73 68 | 6f 72 74 20 2a 29 26 70 |igned sh|ort *)&p|
|00001790| 75 74 54 61 62 6c 65 5b | 69 5d 2e 72 67 62 3b 0d |utTable[|i].rgb;.|
|000017a0| 09 09 67 65 74 33 3d 28 | 75 6e 73 69 67 6e 65 64 |..get3=(|unsigned|
|000017b0| 20 73 68 6f 72 74 20 2a | 29 26 67 65 74 54 61 62 | short *|)&getTab|
|000017c0| 6c 65 5b 69 5d 2e 72 67 | 62 3b 0d 09 09 70 75 74 |le[i].rg|b;...put|
|000017d0| 53 75 6d 5b 69 25 33 5d | 2b 3d 70 75 74 33 5b 69 |Sum[i%3]|+=put3[i|
|000017e0| 25 33 5d 3b 0d 09 09 66 | 6f 72 28 6a 3d 30 3b 6a |%3];...f|or(j=0;j|
|000017f0| 3c 33 3b 6a 2b 2b 29 67 | 65 74 53 75 6d 5b 6a 5d |<3;j++)g|etSum[j]|
|00001800| 5b 69 25 33 5d 2b 3d 67 | 65 74 33 5b 6a 5d 3b 0d |[i%3]+=g|et3[j];.|
|00001810| 09 7d 0d 09 69 73 47 72 | 61 79 3d 21 54 65 73 74 |.}..isGr|ay=!Test|
|00001820| 44 65 76 69 63 65 41 74 | 74 72 69 62 75 74 65 28 |DeviceAt|tribute(|
|00001830| 63 61 72 64 2d 3e 64 65 | 76 69 63 65 2c 67 64 44 |card->de|vice,gdD|
|00001840| 65 76 54 79 70 65 29 3b | 0d 09 71 75 69 63 6b 6c |evType);|..quickl|
|00001850| 79 3d 28 28 66 6c 61 67 | 73 26 74 65 73 74 43 6c |y=((flag|s&testCl|
|00001860| 75 74 51 75 69 63 6b 6c | 79 46 6c 61 67 29 21 3d |utQuickl|yFlag)!=|
|00001870| 30 29 3b 0d 09 63 6c 75 | 74 3d 26 63 61 72 64 2d |0);..clu|t=&card-|
|00001880| 3e 64 65 70 74 68 5b 63 | 61 72 64 2d 3e 64 5d 2e |>depth[c|ard->d].|
|00001890| 63 6c 75 74 5b 71 75 69 | 63 6b 6c 79 5d 5b 69 73 |clut[qui|ckly][is|
|000018a0| 47 72 61 79 5d 3b 0d 09 | 66 6f 72 28 69 3d 30 3b |Gray];..|for(i=0;|
|000018b0| 69 3c 33 3b 69 2b 2b 29 | 66 6f 72 28 6a 3d 30 3b |i<3;i++)|for(j=0;|
|000018c0| 6a 3c 33 3b 6a 2b 2b 29 | 7b 0d 09 09 63 6c 75 74 |j<3;j++)|{...clut|
|000018d0| 2d 3e 72 65 61 64 2e 72 | 67 62 47 61 69 6e 5b 6a |->read.r|gbGain[j|
|000018e0| 5d 5b 69 5d 3d 28 64 6f | 75 62 6c 65 29 67 65 74 |][i]=(do|uble)get|
|000018f0| 53 75 6d 5b 6a 5d 5b 69 | 5d 2f 70 75 74 53 75 6d |Sum[j][i|]/putSum|
|00001900| 5b 69 5d 3b 0d 09 09 69 | 66 28 63 6c 75 74 2d 3e |[i];...i|f(clut->|
|00001910| 72 65 61 64 2e 72 67 62 | 47 61 69 6e 5b 6a 5d 5b |read.rgb|Gain[j][|
|00001920| 69 5d 21 3d 66 6c 6f 6f | 72 28 63 6c 75 74 2d 3e |i]!=floo|r(clut->|
|00001930| 72 65 61 64 2e 72 67 62 | 47 61 69 6e 5b 6a 5d 5b |read.rgb|Gain[j][|
|00001940| 69 5d 29 29 0d 09 09 09 | 63 6c 75 74 2d 3e 72 65 |i]))....|clut->re|
|00001950| 61 64 2e 72 67 62 47 61 | 69 6e 5b 6a 5d 5b 69 5d |ad.rgbGa|in[j][i]|
|00001960| 2b 3d 30 2e 35 2a 74 61 | 62 6c 65 53 69 7a 65 2f |+=0.5*ta|bleSize/|
|00001970| 70 75 74 53 75 6d 5b 69 | 5d 3b 0d 09 7d 0d 09 44 |putSum[i|];..}..D|
|00001980| 69 73 70 6f 73 65 50 74 | 72 28 28 50 74 72 29 70 |isposePt|r((Ptr)p|
|00001990| 75 74 54 61 62 6c 65 29 | 3b 0d 09 44 69 73 70 6f |utTable)|;..Dispo|
|000019a0| 73 65 50 74 72 28 28 50 | 74 72 29 67 65 74 54 61 |sePtr((P|tr)getTa|
|000019b0| 62 6c 65 29 3b 0d 09 72 | 65 74 75 72 6e 20 65 72 |ble);..r|eturn er|
|000019c0| 72 6f 72 3b 0d 7d 0d 0d | 4f 53 45 72 72 20 57 72 |ror;.}..|OSErr Wr|
|000019d0| 69 74 65 41 6e 64 52 65 | 61 64 43 6c 75 74 28 47 |iteAndRe|adClut(G|
|000019e0| 44 48 61 6e 64 6c 65 20 | 64 65 76 69 63 65 2c 73 |DHandle |device,s|
|000019f0| 68 6f 72 74 20 66 6c 61 | 67 73 2c 43 6f 6c 6f 72 |hort fla|gs,Color|
|00001a00| 53 70 65 63 20 2a 2a 70 | 75 74 2c 43 6f 6c 6f 72 |Spec **p|ut,Color|
|00001a10| 53 70 65 63 20 2a 2a 67 | 65 74 29 0d 7b 0d 09 73 |Spec **g|et).{..s|
|00001a20| 68 6f 72 74 20 69 2c 63 | 6c 75 74 53 69 7a 65 2c |hort i,c|lutSize,|
|00001a30| 74 61 62 6c 65 53 69 7a | 65 3b 0d 09 43 6f 6c 6f |tableSiz|e;..Colo|
|00001a40| 72 53 70 65 63 20 73 70 | 65 63 2c 2a 70 75 74 54 |rSpec sp|ec,*putT|
|00001a50| 61 62 6c 65 2c 2a 67 65 | 74 54 61 62 6c 65 3b 0d |able,*ge|tTable;.|
|00001a60| 09 56 42 4c 54 61 73 6b | 41 6e 64 41 35 20 76 62 |.VBLTask|AndA5 vb|
|00001a70| 6c 3b 0d 09 69 6e 74 20 | 65 72 72 6f 72 3d 30 3b |l;..int |error=0;|
|00001a80| 0d 0d 09 63 6c 75 74 53 | 69 7a 65 3d 47 44 43 6c |...clutS|ize=GDCl|
|00001a90| 75 74 53 69 7a 65 28 64 | 65 76 69 63 65 29 3b 0d |utSize(d|evice);.|
|00001aa0| 0d 09 2f 2f 20 4d 41 4b | 45 20 54 41 42 4c 45 20 |..// MAK|E TABLE |
|00001ab0| 46 4f 52 20 43 4c 55 54 | 0d 09 2a 70 75 74 3d 70 |FOR CLUT|..*put=p|
|00001ac0| 75 74 54 61 62 6c 65 3d | 4d 61 6b 65 43 6c 75 74 |utTable=|MakeClut|
|00001ad0| 54 61 62 6c 65 28 64 65 | 76 69 63 65 2c 66 6c 61 |Table(de|vice,fla|
|00001ae0| 67 73 29 3b 0d 09 69 66 | 28 70 75 74 54 61 62 6c |gs);..if|(putTabl|
|00001af0| 65 3d 3d 4e 55 4c 4c 29 | 72 65 74 75 72 6e 20 4d |e==NULL)|return M|
|00001b00| 65 6d 45 72 72 6f 72 28 | 29 3b 0d 09 74 61 62 6c |emError(|);..tabl|
|00001b10| 65 53 69 7a 65 3d 47 65 | 74 50 74 72 53 69 7a 65 |eSize=Ge|tPtrSize|
|00001b20| 28 28 50 74 72 29 70 75 | 74 54 61 62 6c 65 29 2f |((Ptr)pu|tTable)/|
|00001b30| 73 69 7a 65 6f 66 28 70 | 75 74 54 61 62 6c 65 5b |sizeof(p|utTable[|
|00001b40| 30 5d 29 3b 0d 09 0d 09 | 2f 2f 20 4d 41 4b 45 20 |0]);....|// MAKE |
|00001b50| 42 4c 41 4e 4b 20 54 41 | 42 4c 45 0d 09 2a 67 65 |BLANK TA|BLE..*ge|
|00001b60| 74 3d 67 65 74 54 61 62 | 6c 65 3d 28 43 6f 6c 6f |t=getTab|le=(Colo|
|00001b70| 72 53 70 65 63 20 2a 29 | 4e 65 77 50 74 72 28 47 |rSpec *)|NewPtr(G|
|00001b80| 65 74 50 74 72 53 69 7a | 65 28 28 50 74 72 29 70 |etPtrSiz|e((Ptr)p|
|00001b90| 75 74 54 61 62 6c 65 29 | 29 3b 0d 09 69 66 28 67 |utTable)|);..if(g|
|00001ba0| 65 74 54 61 62 6c 65 3d | 3d 4e 55 4c 4c 29 72 65 |etTable=|=NULL)re|
|00001bb0| 74 75 72 6e 20 4d 65 6d | 45 72 72 6f 72 28 29 3b |turn Mem|Error();|
|00001bc0| 0d 09 73 70 65 63 2e 76 | 61 6c 75 65 3d 73 70 65 |..spec.v|alue=spe|
|00001bd0| 63 2e 72 67 62 2e 72 65 | 64 3d 73 70 65 63 2e 72 |c.rgb.re|d=spec.r|
|00001be0| 67 62 2e 67 72 65 65 6e | 3d 73 70 65 63 2e 72 67 |gb.green|=spec.rg|
|00001bf0| 62 2e 62 6c 75 65 3d 30 | 3b 0d 09 66 6f 72 28 69 |b.blue=0|;..for(i|
|00001c00| 3d 30 3b 69 3c 74 61 62 | 6c 65 53 69 7a 65 3b 69 |=0;i<tab|leSize;i|
|00001c10| 2b 2b 29 67 65 74 54 61 | 62 6c 65 5b 69 5d 3d 73 |++)getTa|ble[i]=s|
|00001c20| 70 65 63 3b 0d 0d 09 2f | 2f 20 57 52 49 54 45 20 |pec;.../|/ WRITE |
|00001c30| 43 4c 55 54 20 26 20 52 | 45 41 44 20 42 41 43 4b |CLUT & R|EAD BACK|
|00001c40| 2c 20 4f 4e 45 20 43 4c | 55 54 2d 46 55 4c 4c 20 |, ONE CL|UT-FULL |
|00001c50| 41 54 20 41 20 54 49 4d | 45 0d 09 76 62 6c 2e 73 |AT A TIM|E..vbl.s|
|00001c60| 75 62 72 6f 75 74 69 6e | 65 3d 4e 55 4c 4c 3b 09 |ubroutin|e=NULL;.|
|00001c70| 09 09 09 2f 2f 20 72 65 | 71 75 65 73 74 20 64 65 |...// re|quest de|
|00001c80| 66 61 75 6c 74 20 73 75 | 62 72 6f 75 74 69 6e 65 |fault su|broutine|
|00001c90| 0d 09 65 72 72 6f 72 3d | 56 42 4c 49 6e 73 74 61 |..error=|VBLInsta|
|00001ca0| 6c 6c 28 26 76 62 6c 2c | 64 65 76 69 63 65 2c 31 |ll(&vbl,|device,1|
|00001cb0| 30 30 30 29 3b 0d 09 69 | 66 28 65 72 72 6f 72 29 |000);..i|f(error)|
|00001cc0| 50 72 69 6e 74 66 45 78 | 69 74 28 22 25 73 20 6c |PrintfEx|it("%s l|
|00001cd0| 69 6e 65 20 25 64 2e 20 | 57 72 69 74 65 41 6e 64 |ine %d. |WriteAnd|
|00001ce0| 52 65 61 64 43 6c 75 74 | 3a 56 42 4c 49 6e 73 74 |ReadClut|:VBLInst|
|00001cf0| 61 6c 6c 20 65 72 72 6f | 72 20 25 64 5c 6e 22 0d |all erro|r %d\n".|
|00001d00| 09 09 2c 5f 5f 46 49 4c | 45 5f 5f 2c 5f 5f 4c 49 |..,__FIL|E__,__LI|
|00001d10| 4e 45 5f 5f 2c 65 72 72 | 6f 72 29 3b 0d 09 76 62 |NE__,err|or);..vb|
|00001d20| 6c 2e 76 62 6c 2e 76 62 | 6c 43 6f 75 6e 74 3d 31 |l.vbl.vb|lCount=1|
|00001d30| 3b 09 2f 2f 20 65 6e 61 | 62 6c 65 20 74 68 65 20 |;.// ena|ble the |
|00001d40| 69 6e 74 65 72 72 75 70 | 74 20 73 65 72 76 69 63 |interrup|t servic|
|00001d50| 65 20 72 6f 75 74 69 6e | 65 0d 09 66 6f 72 28 69 |e routin|e..for(i|
|00001d60| 3d 30 3b 69 3c 74 61 62 | 6c 65 53 69 7a 65 3b 69 |=0;i<tab|leSize;i|
|00001d70| 2b 3d 63 6c 75 74 53 69 | 7a 65 29 7b 0d 09 09 65 |+=clutSi|ze){...e|
|00001d80| 72 72 6f 72 3d 57 72 69 | 74 65 43 6c 75 74 28 64 |rror=Wri|teClut(d|
|00001d90| 65 76 69 63 65 2c 26 70 | 75 74 54 61 62 6c 65 5b |evice,&p|utTable[|
|00001da0| 69 5d 2c 66 6c 61 67 73 | 29 3b 0d 09 09 69 66 28 |i],flags|);...if(|
|00001db0| 65 72 72 6f 72 29 62 72 | 65 61 6b 3b 0d 09 09 76 |error)br|eak;...v|
|00001dc0| 62 6c 2e 6e 65 77 46 72 | 61 6d 65 3d 30 3b 0d 09 |bl.newFr|ame=0;..|
|00001dd0| 09 69 66 28 57 41 49 54 | 5f 46 4f 52 5f 56 42 4c |.if(WAIT|_FOR_VBL|
|00001de0| 29 77 68 69 6c 65 28 76 | 62 6c 2e 6e 65 77 46 72 |)while(v|bl.newFr|
|00001df0| 61 6d 65 3d 3d 30 29 20 | 3b 09 2f 2f 20 77 61 69 |ame==0) |;.// wai|
|00001e00| 74 20 75 6e 74 69 6c 20 | 63 6c 75 74 27 73 20 62 |t until |clut's b|
|00001e10| 65 65 6e 20 6c 6f 61 64 | 65 64 20 62 65 66 6f 72 |een load|ed befor|
|00001e20| 65 20 72 65 61 64 69 6e | 67 20 69 74 0d 09 09 65 |e readin|g it...e|
|00001e30| 72 72 6f 72 3d 47 44 47 | 65 74 45 6e 74 72 69 65 |rror=GDG|etEntrie|
|00001e40| 73 28 64 65 76 69 63 65 | 2c 30 2c 63 6c 75 74 53 |s(device|,0,clutS|
|00001e50| 69 7a 65 2d 31 2c 26 67 | 65 74 54 61 62 6c 65 5b |ize-1,&g|etTable[|
|00001e60| 69 5d 29 3b 0d 09 09 69 | 66 28 65 72 72 6f 72 29 |i]);...i|f(error)|
|00001e70| 62 72 65 61 6b 3b 0d 09 | 7d 0d 09 56 42 4c 52 65 |break;..|}..VBLRe|
|00001e80| 6d 6f 76 65 28 26 76 62 | 6c 29 3b 0d 09 72 65 74 |move(&vb|l);..ret|
|00001e90| 75 72 6e 20 65 72 72 6f | 72 3b 0d 7d 0d 0d 4f 53 |urn erro|r;.}..OS|
|00001ea0| 45 72 72 20 43 6f 6d 70 | 75 74 65 52 4d 53 43 6c |Err Comp|uteRMSCl|
|00001eb0| 75 74 45 72 72 6f 72 28 | 46 49 4c 45 20 2a 66 69 |utError(|FILE *fi|
|00001ec0| 6c 65 0d 09 2c 43 6f 6c | 6f 72 53 70 65 63 20 2a |le..,Col|orSpec *|
|00001ed0| 70 75 74 54 61 62 6c 65 | 2c 43 6f 6c 6f 72 53 70 |putTable|,ColorSp|
|00001ee0| 65 63 20 2a 67 65 74 54 | 61 62 6c 65 2c 73 68 6f |ec *getT|able,sho|
|00001ef0| 72 74 20 66 6c 61 67 73 | 2c 56 69 64 65 6f 49 6e |rt flags|,VideoIn|
|00001f00| 66 6f 20 2a 63 61 72 64 | 29 0d 7b 0d 09 73 68 6f |fo *card|).{..sho|
|00001f10| 72 74 20 69 2c 6a 2c 6b | 2c 63 6c 75 74 53 69 7a |rt i,j,k|,clutSiz|
|00001f20| 65 2c 74 61 62 6c 65 53 | 69 7a 65 2c 71 75 69 63 |e,tableS|ize,quic|
|00001f30| 6b 6c 79 2c 69 73 47 72 | 61 79 2c 69 6e 74 65 67 |kly,isGr|ay,integ|
|00001f40| 72 61 6c 47 61 69 6e 73 | 3b 0d 09 75 6e 73 69 67 |ralGains|;..unsig|
|00001f50| 6e 65 64 20 73 68 6f 72 | 74 20 2a 70 75 74 33 2c |ned shor|t *put3,|
|00001f60| 2a 67 65 74 33 2c 6e 5b | 33 5d 2c 62 61 64 3b 0d |*get3,n[|3],bad;.|
|00001f70| 09 64 6f 75 62 6c 65 20 | 65 2c 73 71 75 61 72 65 |.double |e,square|
|00001f80| 64 45 72 72 6f 72 5b 33 | 5d 2c 6d 6f 64 65 6c 5b |dError[3|],model[|
|00001f90| 33 5d 3b 0d 09 56 69 64 | 65 6f 43 61 72 64 43 6c |3];..Vid|eoCardCl|
|00001fa0| 75 74 54 65 73 74 20 2a | 63 6c 75 74 3b 0d 09 69 |utTest *|clut;..i|
|00001fb0| 6e 74 20 65 72 72 6f 72 | 3d 30 3b 0d 09 09 0d 09 |nt error|=0;.....|
|00001fc0| 69 73 47 72 61 79 3d 21 | 54 65 73 74 44 65 76 69 |isGray=!|TestDevi|
|00001fd0| 63 65 41 74 74 72 69 62 | 75 74 65 28 63 61 72 64 |ceAttrib|ute(card|
|00001fe0| 2d 3e 64 65 76 69 63 65 | 2c 67 64 44 65 76 54 79 |->device|,gdDevTy|
|00001ff0| 70 65 29 3b 0d 09 71 75 | 69 63 6b 6c 79 3d 28 28 |pe);..qu|ickly=((|
|00002000| 66 6c 61 67 73 26 74 65 | 73 74 43 6c 75 74 51 75 |flags&te|stClutQu|
|00002010| 69 63 6b 6c 79 46 6c 61 | 67 29 21 3d 30 29 3b 0d |icklyFla|g)!=0);.|
|00002020| 09 63 6c 75 74 3d 26 63 | 61 72 64 2d 3e 64 65 70 |.clut=&c|ard->dep|
|00002030| 74 68 5b 63 61 72 64 2d | 3e 64 5d 2e 63 6c 75 74 |th[card-|>d].clut|
|00002040| 5b 71 75 69 63 6b 6c 79 | 5d 5b 69 73 47 72 61 79 |[quickly|][isGray|
|00002050| 5d 3b 0d 09 63 6c 75 74 | 53 69 7a 65 3d 47 44 43 |];..clut|Size=GDC|
|00002060| 6c 75 74 53 69 7a 65 28 | 63 61 72 64 2d 3e 64 65 |lutSize(|card->de|
|00002070| 76 69 63 65 29 3b 0d 09 | 74 61 62 6c 65 53 69 7a |vice);..|tableSiz|
|00002080| 65 3d 47 65 74 50 74 72 | 53 69 7a 65 28 28 50 74 |e=GetPtr|Size((Pt|
|00002090| 72 29 70 75 74 54 61 62 | 6c 65 29 2f 73 69 7a 65 |r)putTab|le)/size|
|000020a0| 6f 66 28 70 75 74 54 61 | 62 6c 65 5b 30 5d 29 3b |of(putTa|ble[0]);|
|000020b0| 0d 0d 09 2f 2f 20 45 73 | 74 69 6d 61 74 65 20 65 |...// Es|timate e|
|000020c0| 72 72 6f 72 20 6f 66 20 | 6c 69 6e 65 61 72 20 6d |rror of |linear m|
|000020d0| 6f 64 65 6c 0d 09 66 6f | 72 28 69 3d 30 3b 69 3c |odel..fo|r(i=0;i<|
|000020e0| 33 3b 69 2b 2b 29 7b 0d | 09 09 73 71 75 61 72 65 |3;i++){.|..square|
|000020f0| 64 45 72 72 6f 72 5b 69 | 5d 3d 30 3b 0d 09 09 6e |dError[i|]=0;...n|
|00002100| 5b 69 5d 3d 30 3b 0d 09 | 7d 0d 09 62 61 64 3d 30 |[i]=0;..|}..bad=0|
|00002110| 3b 0d 09 2f 2f 20 41 6c | 6c 6f 77 20 65 72 72 6f |;..// Al|low erro|
|00002120| 72 20 6f 66 20 61 20 66 | 65 77 20 6c 65 61 73 74 |r of a f|ew least|
|00002130| 20 73 69 67 6e 69 66 69 | 63 61 6e 74 20 73 74 65 | signifi|cant ste|
|00002140| 70 73 20 6f 66 20 64 61 | 63 0d 09 63 6c 75 74 2d |ps of da|c..clut-|
|00002150| 3e 72 65 61 64 2e 74 6f | 6c 65 72 61 6e 63 65 3d |>read.to|lerance=|
|00002160| 32 2e 39 2a 28 31 3c 3c | 28 31 36 2d 47 44 44 61 |2.9*(1<<|(16-GDDa|
|00002170| 63 53 69 7a 65 28 63 61 | 72 64 2d 3e 64 65 76 69 |cSize(ca|rd->devi|
|00002180| 63 65 29 29 29 3b 0d 09 | 66 6f 72 28 69 3d 30 3b |ce)));..|for(i=0;|
|00002190| 69 3c 74 61 62 6c 65 53 | 69 7a 65 3b 69 2b 2b 29 |i<tableS|ize;i++)|
|000021a0| 7b 0d 09 09 70 75 74 33 | 3d 28 75 6e 73 69 67 6e |{...put3|=(unsign|
|000021b0| 65 64 20 73 68 6f 72 74 | 20 2a 29 26 70 75 74 54 |ed short| *)&putT|
|000021c0| 61 62 6c 65 5b 69 5d 2e | 72 67 62 3b 0d 09 09 67 |able[i].|rgb;...g|
|000021d0| 65 74 33 3d 28 75 6e 73 | 69 67 6e 65 64 20 73 68 |et3=(uns|igned sh|
|000021e0| 6f 72 74 20 2a 29 26 67 | 65 74 54 61 62 6c 65 5b |ort *)&g|etTable[|
|000021f0| 69 5d 2e 72 67 62 3b 0d | 09 09 66 6f 72 28 6a 3d |i].rgb;.|..for(j=|
|00002200| 30 3b 6a 3c 33 3b 6a 2b | 2b 29 7b 0d 09 09 09 6d |0;j<3;j+|+){....m|
|00002210| 6f 64 65 6c 5b 6a 5d 3d | 70 75 74 33 5b 30 5d 2a |odel[j]=|put3[0]*|
|00002220| 63 6c 75 74 2d 3e 72 65 | 61 64 2e 72 67 62 47 61 |clut->re|ad.rgbGa|
|00002230| 69 6e 5b 6a 5d 5b 30 5d | 0d 09 09 09 09 2b 70 75 |in[j][0]|.....+pu|
|00002240| 74 33 5b 31 5d 2a 63 6c | 75 74 2d 3e 72 65 61 64 |t3[1]*cl|ut->read|
|00002250| 2e 72 67 62 47 61 69 6e | 5b 6a 5d 5b 31 5d 0d 09 |.rgbGain|[j][1]..|
|00002260| 09 09 09 2b 70 75 74 33 | 5b 32 5d 2a 63 6c 75 74 |...+put3|[2]*clut|
|00002270| 2d 3e 72 65 61 64 2e 72 | 67 62 47 61 69 6e 5b 6a |->read.r|gbGain[j|
|00002280| 5d 5b 32 5d 3b 0d 09 09 | 09 65 3d 67 65 74 33 5b |][2];...|.e=get3[|
|00002290| 6a 5d 2d 6d 6f 64 65 6c | 5b 6a 5d 3b 0d 09 09 09 |j]-model|[j];....|
|000022a0| 62 61 64 7c 3d 66 61 62 | 73 28 65 29 3e 63 6c 75 |bad|=fab|s(e)>clu|
|000022b0| 74 2d 3e 72 65 61 64 2e | 74 6f 6c 65 72 61 6e 63 |t->read.|toleranc|
|000022c0| 65 3b 0d 09 09 09 73 71 | 75 61 72 65 64 45 72 72 |e;....sq|uaredErr|
|000022d0| 6f 72 5b 6a 5d 2b 3d 65 | 2a 65 3b 0d 09 09 09 6e |or[j]+=e|*e;....n|
|000022e0| 5b 6a 5d 2b 2b 3b 0d 09 | 09 7d 0d 09 7d 0d 09 66 |[j]++;..|.}..}..f|
|000022f0| 6f 72 28 69 3d 30 3b 69 | 3c 33 3b 69 2b 2b 29 7b |or(i=0;i|<3;i++){|
|00002300| 0d 09 09 63 6c 75 74 2d | 3e 72 65 61 64 2e 72 67 |...clut-|>read.rg|
|00002310| 62 45 72 72 6f 72 5b 69 | 5d 3d 73 71 72 74 28 73 |bError[i|]=sqrt(s|
|00002320| 71 75 61 72 65 64 45 72 | 72 6f 72 5b 69 5d 2f 6e |quaredEr|ror[i]/n|
|00002330| 5b 69 5d 29 3b 0d 09 09 | 69 66 28 21 28 66 6c 61 |[i]);...|if(!(fla|
|00002340| 67 73 26 74 65 73 74 43 | 6c 75 74 53 65 72 69 61 |gs&testC|lutSeria|
|00002350| 6c 6c 79 46 6c 61 67 29 | 29 63 6c 75 74 2d 3e 72 |llyFlag)|)clut->r|
|00002360| 65 61 64 2e 72 67 62 45 | 72 72 6f 72 41 74 4f 6e |ead.rgbE|rrorAtOn|
|00002370| 63 65 5b 69 5d 3d 73 71 | 72 74 28 73 71 75 61 72 |ce[i]=sq|rt(squar|
|00002380| 65 64 45 72 72 6f 72 5b | 69 5d 2f 6e 5b 69 5d 29 |edError[|i]/n[i])|
|00002390| 3b 0d 09 7d 0d 0d 09 63 | 6c 75 74 2d 3e 72 65 61 |;..}...c|lut->rea|
|000023a0| 64 2e 69 64 65 6e 74 69 | 74 79 3d 31 3b 0d 09 66 |d.identi|ty=1;..f|
|000023b0| 6f 72 28 69 3d 30 3b 69 | 3c 33 3b 69 2b 2b 29 66 |or(i=0;i|<3;i++)f|
|000023c0| 6f 72 28 6a 3d 30 3b 6a | 3c 33 3b 6a 2b 2b 29 63 |or(j=0;j|<3;j++)c|
|000023d0| 6c 75 74 2d 3e 72 65 61 | 64 2e 69 64 65 6e 74 69 |lut->rea|d.identi|
|000023e0| 74 79 26 3d 28 66 61 62 | 73 28 63 6c 75 74 2d 3e |ty&=(fab|s(clut->|
|000023f0| 72 65 61 64 2e 72 67 62 | 47 61 69 6e 5b 69 5d 5b |read.rgb|Gain[i][|
|00002400| 6a 5d 2d 28 69 3d 3d 6a | 29 29 3c 30 2e 30 30 31 |j]-(i==j|))<0.001|
|00002410| 29 3b 0d 09 0d 09 69 66 | 28 62 61 64 29 7b 0d 09 |);....if|(bad){..|
|00002420| 09 63 6c 75 74 2d 3e 72 | 65 61 64 2e 65 72 72 6f |.clut->r|ead.erro|
|00002430| 72 73 3d 31 3b 0d 09 09 | 69 66 28 21 28 66 6c 61 |rs=1;...|if(!(fla|
|00002440| 67 73 26 74 65 73 74 43 | 6c 75 74 53 65 72 69 61 |gs&testC|lutSeria|
|00002450| 6c 6c 79 46 6c 61 67 29 | 29 63 6c 75 74 2d 3e 72 |llyFlag)|)clut->r|
|00002460| 65 61 64 2e 65 72 72 6f | 72 73 41 74 4f 6e 63 65 |ead.erro|rsAtOnce|
|00002470| 3d 31 3b 0d 09 7d 0d 09 | 69 66 28 62 61 64 29 7b |=1;..}..|if(bad){|
|00002480| 0d 09 09 2f 2f 20 50 72 | 69 6e 74 20 6f 6e 65 2d |...// Pr|int one-|
|00002490| 6c 69 6e 65 20 65 72 72 | 6f 72 20 6d 65 73 73 61 |line err|or messa|
|000024a0| 67 65 20 74 6f 20 66 69 | 6c 65 2e 0d 09 09 66 70 |ge to fi|le....fp|
|000024b0| 72 69 6e 74 66 28 66 69 | 6c 65 2c 22 5c 6e 22 29 |rintf(fi|le,"\n")|
|000024c0| 3b 0d 09 09 69 66 28 66 | 6c 61 67 73 26 74 65 73 |;...if(f|lags&tes|
|000024d0| 74 43 6c 75 74 51 75 69 | 63 6b 6c 79 46 6c 61 67 |tClutQui|cklyFlag|
|000024e0| 29 66 70 72 69 6e 74 66 | 28 66 69 6c 65 2c 22 53 |)fprintf|(file,"S|
|000024f0| 65 74 45 6e 74 72 69 65 | 73 51 75 69 63 6b 6c 79 |etEntrie|sQuickly|
|00002500| 20 21 3d 20 63 73 63 47 | 65 74 45 6e 74 72 69 65 | != cscG|etEntrie|
|00002510| 73 2e 20 22 29 3b 0d 09 | 09 65 6c 73 65 20 73 77 |s. ");..|.else sw|
|00002520| 69 74 63 68 28 28 2a 63 | 61 72 64 2d 3e 64 65 76 |itch((*c|ard->dev|
|00002530| 69 63 65 29 2d 3e 67 64 | 54 79 70 65 29 7b 0d 09 |ice)->gd|Type){..|
|00002540| 09 63 61 73 65 20 66 69 | 78 65 64 54 79 70 65 3a |.case fi|xedType:|
|00002550| 0d 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 63 61 73 |....brea|k;...cas|
|00002560| 65 20 63 6c 75 74 54 79 | 70 65 3a 0d 09 09 09 66 |e clutTy|pe:....f|
|00002570| 70 72 69 6e 74 66 28 66 | 69 6c 65 2c 22 63 73 63 |printf(f|ile,"csc|
|00002580| 53 65 74 45 6e 74 72 69 | 65 73 20 21 3d 20 63 73 |SetEntri|es != cs|
|00002590| 63 47 65 74 45 6e 74 72 | 69 65 73 2e 20 22 29 3b |cGetEntr|ies. ");|
|000025a0| 0d 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 63 61 73 |....brea|k;...cas|
|000025b0| 65 20 64 69 72 65 63 74 | 54 79 70 65 3a 0d 09 09 |e direct|Type:...|
|000025c0| 09 66 70 72 69 6e 74 66 | 28 66 69 6c 65 2c 22 63 |.fprintf|(file,"c|
|000025d0| 73 63 44 69 72 65 63 74 | 53 65 74 45 6e 74 72 69 |scDirect|SetEntri|
|000025e0| 65 73 20 21 3d 20 63 73 | 63 47 65 74 45 6e 74 72 |es != cs|cGetEntr|
|000025f0| 69 65 73 2e 20 22 29 3b | 0d 09 09 09 62 72 65 61 |ies. ");|....brea|
|00002600| 6b 3b 0d 09 09 7d 0d 09 | 09 66 70 72 69 6e 74 66 |k;...}..|.fprintf|
|00002610| 28 66 69 6c 65 2c 22 25 | 64 2d 62 69 74 20 22 2c |(file,"%|d-bit ",|
|00002620| 28 69 6e 74 29 63 61 72 | 64 2d 3e 64 65 70 74 68 |(int)car|d->depth|
|00002630| 5b 63 61 72 64 2d 3e 64 | 5d 2e 70 69 78 65 6c 53 |[card->d|].pixelS|
|00002640| 69 7a 65 29 3b 0d 09 09 | 69 66 28 69 73 47 72 61 |ize);...|if(isGra|
|00002650| 79 29 66 70 72 69 6e 74 | 66 28 66 69 6c 65 2c 22 |y)fprint|f(file,"|
|00002660| 67 72 61 79 20 70 69 78 | 65 6c 73 2e 22 29 3b 0d |gray pix|els.");.|
|00002670| 09 09 65 6c 73 65 20 66 | 70 72 69 6e 74 66 28 66 |..else f|printf(f|
|00002680| 69 6c 65 2c 22 63 6f 6c | 6f 72 20 70 69 78 65 6c |ile,"col|or pixel|
|00002690| 73 2e 22 29 3b 0d 09 09 | 69 66 28 66 6c 61 67 73 |s.");...|if(flags|
|000026a0| 26 74 65 73 74 43 6c 75 | 74 53 65 72 69 61 6c 6c |&testClu|tSeriall|
|000026b0| 79 46 6c 61 67 29 66 70 | 72 69 6e 74 66 28 66 69 |yFlag)fp|rintf(fi|
|000026c0| 6c 65 2c 22 20 4c 6f 61 | 64 65 64 20 6f 6e 65 20 |le," Loa|ded one |
|000026d0| 63 6c 75 74 20 65 6e 74 | 72 79 20 61 74 20 61 20 |clut ent|ry at a |
|000026e0| 74 69 6d 65 2e 5c 6e 22 | 29 3b 0d 09 09 65 6c 73 |time.\n"|);...els|
|000026f0| 65 20 66 70 72 69 6e 74 | 66 28 66 69 6c 65 2c 22 |e fprint|f(file,"|
|00002700| 20 4c 6f 61 64 65 64 20 | 77 68 6f 6c 65 20 63 6c | Loaded |whole cl|
|00002710| 75 74 20 61 74 20 6f 6e | 63 65 2e 5c 6e 22 29 3b |ut at on|ce.\n");|
|00002720| 0d 0d 09 09 2f 2f 20 50 | 72 69 6e 74 20 74 68 65 |....// P|rint the|
|00002730| 20 65 73 74 69 6d 61 74 | 65 64 20 63 6f 6c 6f 72 | estimat|ed color|
|00002740| 20 74 72 61 6e 73 66 6f | 72 6d 61 74 69 6f 6e 20 | transfo|rmation |
|00002750| 6d 61 74 72 69 78 0d 09 | 09 66 70 72 69 6e 74 66 |matrix..|.fprintf|
|00002760| 28 66 69 6c 65 2c 22 5c | 22 65 78 70 65 63 74 65 |(file,"\|"expecte|
|00002770| 64 5c 22 20 61 73 73 75 | 6d 65 73 20 74 68 65 20 |d\" assu|mes the |
|00002780| 62 65 73 74 2d 66 69 74 | 20 6c 69 6e 65 61 72 20 |best-fit| linear |
|00002790| 63 6f 6c 6f 72 20 74 72 | 61 6e 73 66 6f 72 6d 61 |color tr|ansforma|
|000027a0| 74 69 6f 6e 20 6d 61 74 | 72 69 78 3a 5c 6e 22 29 |tion mat|rix:\n")|
|000027b0| 3b 0d 09 09 69 6e 74 65 | 67 72 61 6c 47 61 69 6e |;...inte|gralGain|
|000027c0| 73 3d 31 3b 0d 09 09 66 | 6f 72 28 6a 3d 30 3b 6a |s=1;...f|or(j=0;j|
|000027d0| 3c 33 3b 6a 2b 2b 29 66 | 6f 72 28 6b 3d 30 3b 6b |<3;j++)f|or(k=0;k|
|000027e0| 3c 33 3b 6b 2b 2b 29 0d | 09 09 09 09 69 6e 74 65 |<3;k++).|....inte|
|000027f0| 67 72 61 6c 47 61 69 6e | 73 26 3d 28 63 6c 75 74 |gralGain|s&=(clut|
|00002800| 2d 3e 72 65 61 64 2e 72 | 67 62 47 61 69 6e 5b 6a |->read.r|gbGain[j|
|00002810| 5d 5b 6b 5d 3d 3d 66 6c | 6f 6f 72 28 63 6c 75 74 |][k]==fl|oor(clut|
|00002820| 2d 3e 72 65 61 64 2e 72 | 67 62 47 61 69 6e 5b 6a |->read.r|gbGain[j|
|00002830| 5d 5b 6b 5d 29 29 3b 0d | 09 09 66 6f 72 28 6a 3d |][k]));.|..for(j=|
|00002840| 30 3b 6a 3c 33 3b 6a 2b | 2b 29 7b 0d 09 09 09 66 |0;j<3;j+|+){....f|
|00002850| 70 72 69 6e 74 66 28 66 | 69 6c 65 2c 22 20 28 25 |printf(f|ile," (%|
|00002860| 63 4f 75 74 b1 25 34 2e | 31 66 25 25 29 25 63 22 |cOut.%4.|1f%%)%c"|
|00002870| 0d 09 09 09 09 2c 22 52 | 47 42 22 5b 6a 5d 2c 63 |.....,"R|GB"[j],c|
|00002880| 6c 75 74 2d 3e 72 65 61 | 64 2e 72 67 62 45 72 72 |lut->rea|d.rgbErr|
|00002890| 6f 72 5b 6a 5d 2a 31 30 | 30 2e 2f 55 53 48 52 54 |or[j]*10|0./USHRT|
|000028a0| 5f 4d 41 58 2c 22 20 3d | 20 22 5b 6a 5d 29 3b 0d |_MAX," =| "[j]);.|
|000028b0| 09 09 09 69 66 28 69 6e | 74 65 67 72 61 6c 47 61 |...if(in|tegralGa|
|000028c0| 69 6e 73 29 66 70 72 69 | 6e 74 66 28 66 69 6c 65 |ins)fpri|ntf(file|
|000028d0| 2c 22 28 25 31 2e 30 66 | 20 25 31 2e 30 66 20 25 |,"(%1.0f| %1.0f %|
|000028e0| 31 2e 30 66 29 22 0d 09 | 09 09 09 2c 63 6c 75 74 |1.0f)"..|...,clut|
|000028f0| 2d 3e 72 65 61 64 2e 72 | 67 62 47 61 69 6e 5b 6a |->read.r|gbGain[j|
|00002900| 5d 5b 30 5d 2c 63 6c 75 | 74 2d 3e 72 65 61 64 2e |][0],clu|t->read.|
|00002910| 72 67 62 47 61 69 6e 5b | 6a 5d 5b 31 5d 2c 63 6c |rgbGain[|j][1],cl|
|00002920| 75 74 2d 3e 72 65 61 64 | 2e 72 67 62 47 61 69 6e |ut->read|.rgbGain|
|00002930| 5b 6a 5d 5b 32 5d 29 3b | 0d 09 09 09 65 6c 73 65 |[j][2]);|....else|
|00002940| 20 66 70 72 69 6e 74 66 | 28 66 69 6c 65 2c 22 28 | fprintf|(file,"(|
|00002950| 25 33 2e 32 66 20 25 33 | 2e 32 66 20 25 33 2e 32 |%3.2f %3|.2f %3.2|
|00002960| 66 29 22 0d 09 09 09 09 | 2c 63 6c 75 74 2d 3e 72 |f)".....|,clut->r|
|00002970| 65 61 64 2e 72 67 62 47 | 61 69 6e 5b 6a 5d 5b 30 |ead.rgbG|ain[j][0|
|00002980| 5d 2c 63 6c 75 74 2d 3e | 72 65 61 64 2e 72 67 62 |],clut->|read.rgb|
|00002990| 47 61 69 6e 5b 6a 5d 5b | 31 5d 2c 63 6c 75 74 2d |Gain[j][|1],clut-|
|000029a0| 3e 72 65 61 64 2e 72 67 | 62 47 61 69 6e 5b 6a 5d |>read.rg|bGain[j]|
|000029b0| 5b 32 5d 29 3b 0d 09 09 | 09 66 70 72 69 6e 74 66 |[2]);...|.fprintf|
|000029c0| 28 66 69 6c 65 2c 22 25 | 63 28 25 63 49 6e 29 5c |(file,"%|c(%cIn)\|
|000029d0| 6e 22 2c 22 20 78 20 22 | 5b 6a 5d 2c 22 52 47 42 |n"," x "|[j],"RGB|
|000029e0| 22 5b 6a 5d 29 3b 0d 09 | 09 7d 0d 09 09 0d 09 09 |"[j]);..|.}......|
|000029f0| 2f 2f 20 50 72 69 6e 74 | 20 65 61 63 68 20 63 6c |// Print| each cl|
|00002a00| 75 74 20 65 72 72 6f 72 | 2e 0d 09 09 66 6f 72 28 |ut error|....for(|
|00002a10| 69 3d 30 3b 69 3c 74 61 | 62 6c 65 53 69 7a 65 3b |i=0;i<ta|bleSize;|
|00002a20| 69 2b 2b 29 7b 0d 09 09 | 09 70 75 74 33 3d 28 75 |i++){...|.put3=(u|
|00002a30| 6e 73 69 67 6e 65 64 20 | 73 68 6f 72 74 20 2a 29 |nsigned |short *)|
|00002a40| 26 70 75 74 54 61 62 6c | 65 5b 69 5d 2e 72 67 62 |&putTabl|e[i].rgb|
|00002a50| 3b 0d 09 09 09 67 65 74 | 33 3d 28 75 6e 73 69 67 |;....get|3=(unsig|
|00002a60| 6e 65 64 20 73 68 6f 72 | 74 20 2a 29 26 67 65 74 |ned shor|t *)&get|
|00002a70| 54 61 62 6c 65 5b 69 5d | 2e 72 67 62 3b 0d 09 09 |Table[i]|.rgb;...|
|00002a80| 09 62 61 64 3d 30 3b 0d | 09 09 09 66 6f 72 28 6a |.bad=0;.|...for(j|
|00002a90| 3d 30 3b 6a 3c 33 3b 6a | 2b 2b 29 7b 0d 09 09 09 |=0;j<3;j|++){....|
|00002aa0| 09 6d 6f 64 65 6c 5b 6a | 5d 3d 70 75 74 33 5b 30 |.model[j|]=put3[0|
|00002ab0| 5d 2a 63 6c 75 74 2d 3e | 72 65 61 64 2e 72 67 62 |]*clut->|read.rgb|
|00002ac0| 47 61 69 6e 5b 6a 5d 5b | 30 5d 0d 09 09 09 09 09 |Gain[j][|0]......|
|00002ad0| 2b 70 75 74 33 5b 31 5d | 2a 63 6c 75 74 2d 3e 72 |+put3[1]|*clut->r|
|00002ae0| 65 61 64 2e 72 67 62 47 | 61 69 6e 5b 6a 5d 5b 31 |ead.rgbG|ain[j][1|
|00002af0| 5d 0d 09 09 09 09 09 2b | 70 75 74 33 5b 32 5d 2a |]......+|put3[2]*|
|00002b00| 63 6c 75 74 2d 3e 72 65 | 61 64 2e 72 67 62 47 61 |clut->re|ad.rgbGa|
|00002b10| 69 6e 5b 6a 5d 5b 32 5d | 3b 0d 09 09 09 09 65 3d |in[j][2]|;.....e=|
|00002b20| 67 65 74 33 5b 6a 5d 2d | 6d 6f 64 65 6c 5b 6a 5d |get3[j]-|model[j]|
|00002b30| 3b 0d 09 09 09 09 62 61 | 64 7c 3d 66 61 62 73 28 |;.....ba|d|=fabs(|
|00002b40| 65 29 3e 63 6c 75 74 2d | 3e 72 65 61 64 2e 74 6f |e)>clut-|>read.to|
|00002b50| 6c 65 72 61 6e 63 65 3b | 0d 09 09 09 7d 0d 09 09 |lerance;|....}...|
|00002b60| 09 69 66 28 30 20 26 26 | 20 62 61 64 29 66 70 72 |.if(0 &&| bad)fpr|
|00002b70| 69 6e 74 66 28 66 69 6c | 65 2c 22 43 6c 75 74 5b |intf(fil|e,"Clut[|
|00002b80| 25 33 64 5d 20 77 72 6f | 74 65 28 25 30 34 75 2c |%3d] wro|te(%04u,|
|00002b90| 25 30 34 75 2c 25 30 34 | 75 29 20 22 0d 09 09 09 |%04u,%04|u) "....|
|00002ba0| 09 22 65 78 70 65 63 74 | 65 64 28 25 30 34 2e 30 |."expect|ed(%04.0|
|00002bb0| 66 2c 25 30 34 2e 30 66 | 2c 25 30 34 2e 30 66 29 |f,%04.0f|,%04.0f)|
|00002bc0| 20 62 75 74 20 72 65 61 | 64 28 25 30 34 75 2c 25 | but rea|d(%04u,%|
|00002bd0| 30 34 75 2c 25 30 34 75 | 29 5c 6e 22 0d 09 09 09 |04u,%04u|)\n"....|
|00002be0| 09 2c 69 25 63 6c 75 74 | 53 69 7a 65 2c 70 75 74 |.,i%clut|Size,put|
|00002bf0| 33 5b 30 5d 2c 70 75 74 | 33 5b 31 5d 2c 70 75 74 |3[0],put|3[1],put|
|00002c00| 33 5b 32 5d 0d 09 09 09 | 09 2c 6d 6f 64 65 6c 5b |3[2]....|.,model[|
|00002c10| 30 5d 2c 6d 6f 64 65 6c | 5b 31 5d 2c 6d 6f 64 65 |0],model|[1],mode|
|00002c20| 6c 5b 32 5d 0d 09 09 09 | 09 2c 67 65 74 33 5b 30 |l[2]....|.,get3[0|
|00002c30| 5d 2c 67 65 74 33 5b 31 | 5d 2c 67 65 74 33 5b 32 |],get3[1|],get3[2|
|00002c40| 5d 29 3b 0d 09 09 09 69 | 66 28 62 61 64 29 66 70 |]);....i|f(bad)fp|
|00002c50| 72 69 6e 74 66 28 66 69 | 6c 65 2c 22 43 6c 75 74 |rintf(fi|le,"Clut|
|00002c60| 5b 25 33 64 5d 20 77 72 | 6f 74 65 28 25 30 34 78 |[%3d] wr|ote(%04x|
|00002c70| 2c 25 30 34 78 2c 25 30 | 34 78 29 20 22 0d 09 09 |,%04x,%0|4x) "...|
|00002c80| 09 09 22 65 78 70 65 63 | 74 65 64 28 25 30 34 78 |.."expec|ted(%04x|
|00002c90| 2c 25 30 34 78 2c 25 30 | 34 78 29 20 62 75 74 20 |,%04x,%0|4x) but |
|00002ca0| 72 65 61 64 28 25 30 34 | 78 2c 25 30 34 78 2c 25 |read(%04|x,%04x,%|
|00002cb0| 30 34 78 29 5c 6e 22 0d | 09 09 09 09 2c 69 25 63 |04x)\n".|....,i%c|
|00002cc0| 6c 75 74 53 69 7a 65 2c | 70 75 74 33 5b 30 5d 2c |lutSize,|put3[0],|
|00002cd0| 70 75 74 33 5b 31 5d 2c | 70 75 74 33 5b 32 5d 0d |put3[1],|put3[2].|
|00002ce0| 09 09 09 09 2c 28 75 6e | 73 69 67 6e 65 64 20 73 |....,(un|signed s|
|00002cf0| 68 6f 72 74 29 28 30 2e | 35 2b 6d 6f 64 65 6c 5b |hort)(0.|5+model[|
|00002d00| 30 5d 29 2c 28 75 6e 73 | 69 67 6e 65 64 20 73 68 |0]),(uns|igned sh|
|00002d10| 6f 72 74 29 28 30 2e 35 | 2b 6d 6f 64 65 6c 5b 31 |ort)(0.5|+model[1|
|00002d20| 5d 29 2c 28 75 6e 73 69 | 67 6e 65 64 20 73 68 6f |]),(unsi|gned sho|
|00002d30| 72 74 29 28 30 2e 35 2b | 6d 6f 64 65 6c 5b 32 5d |rt)(0.5+|model[2]|
|00002d40| 29 0d 09 09 09 09 2c 67 | 65 74 33 5b 30 5d 2c 67 |).....,g|et3[0],g|
|00002d50| 65 74 33 5b 31 5d 2c 67 | 65 74 33 5b 32 5d 29 3b |et3[1],g|et3[2]);|
|00002d60| 0d 09 09 7d 0d 09 09 66 | 70 72 69 6e 74 66 28 66 |...}...f|printf(f|
|00002d70| 69 6c 65 2c 22 5c 6e 22 | 29 3b 0d 09 7d 0d 09 63 |ile,"\n"|);..}..c|
|00002d80| 6c 75 74 2d 3e 72 65 61 | 64 2e 74 65 73 74 65 64 |lut->rea|d.tested|
|00002d90| 3d 31 3b 0d 09 72 65 74 | 75 72 6e 20 65 72 72 6f |=1;..ret|urn erro|
|00002da0| 72 3b 0d 7d 0d 0d 4f 53 | 45 72 72 20 47 44 54 65 |r;.}..OS|Err GDTe|
|00002db0| 73 74 43 6c 75 74 56 69 | 73 75 61 6c 6c 79 28 73 |stClutVi|sually(s|
|00002dc0| 68 6f 72 74 20 66 6c 61 | 67 73 2c 56 69 64 65 6f |hort fla|gs,Video|
|00002dd0| 49 6e 66 6f 20 2a 63 61 | 72 64 29 0d 7b 0d 09 69 |Info *ca|rd).{..i|
|00002de0| 6e 74 20 65 72 72 6f 72 | 3b 0d 09 73 68 6f 72 74 |nt error|;..short|
|00002df0| 20 63 6c 75 74 53 69 7a | 65 2c 71 75 69 63 6b 6c | clutSiz|e,quickl|
|00002e00| 79 2c 69 73 47 72 61 79 | 3b 0d 09 43 6f 6c 6f 72 |y,isGray|;..Color|
|00002e10| 53 70 65 63 20 2a 70 75 | 74 54 61 62 6c 65 2c 2a |Spec *pu|tTable,*|
|00002e20| 6e 6f 72 6d 61 6c 54 61 | 62 6c 65 3b 0d 09 42 6f |normalTa|ble;..Bo|
|00002e30| 6f 6c 65 61 6e 20 77 65 | 69 72 64 45 72 72 6f 72 |olean we|irdError|
|00002e40| 2c 6e 6f 72 6d 61 6c 45 | 72 72 6f 72 3b 0d 09 56 |,normalE|rror;..V|
|00002e50| 69 64 65 6f 43 61 72 64 | 43 6c 75 74 54 65 73 74 |ideoCard|ClutTest|
|00002e60| 20 2a 63 6c 75 74 3b 0d | 09 0d 09 69 73 47 72 61 | *clut;.|...isGra|
|00002e70| 79 3d 21 54 65 73 74 44 | 65 76 69 63 65 41 74 74 |y=!TestD|eviceAtt|
|00002e80| 72 69 62 75 74 65 28 63 | 61 72 64 2d 3e 64 65 76 |ribute(c|ard->dev|
|00002e90| 69 63 65 2c 67 64 44 65 | 76 54 79 70 65 29 3b 0d |ice,gdDe|vType);.|
|00002ea0| 09 71 75 69 63 6b 6c 79 | 3d 28 28 66 6c 61 67 73 |.quickly|=((flags|
|00002eb0| 26 74 65 73 74 43 6c 75 | 74 51 75 69 63 6b 6c 79 |&testClu|tQuickly|
|00002ec0| 46 6c 61 67 29 21 3d 30 | 29 3b 0d 09 63 6c 75 74 |Flag)!=0|);..clut|
|00002ed0| 3d 26 63 61 72 64 2d 3e | 64 65 70 74 68 5b 63 61 |=&card->|depth[ca|
|00002ee0| 72 64 2d 3e 64 5d 2e 63 | 6c 75 74 5b 71 75 69 63 |rd->d].c|lut[quic|
|00002ef0| 6b 6c 79 5d 5b 69 73 47 | 72 61 79 5d 3b 0d 09 69 |kly][isG|ray];..i|
|00002f00| 66 28 63 6c 75 74 2d 3e | 76 69 73 75 61 6c 2e 74 |f(clut->|visual.t|
|00002f10| 65 73 74 65 64 3d 3d 30 | 29 7b 0d 09 09 63 6c 75 |ested==0|){...clu|
|00002f20| 74 2d 3e 76 69 73 75 61 | 6c 2e 65 72 72 6f 72 73 |t->visua|l.errors|
|00002f30| 3d 30 3b 0d 09 09 63 6c | 75 74 2d 3e 76 69 73 75 |=0;...cl|ut->visu|
|00002f40| 61 6c 2e 65 72 72 6f 72 | 73 41 74 4f 6e 63 65 3d |al.error|sAtOnce=|
|00002f50| 30 3b 0d 09 7d 0d 09 69 | 66 28 63 61 72 64 2d 3e |0;..}..i|f(card->|
|00002f60| 64 65 76 69 63 65 3d 3d | 4e 55 4c 4c 29 72 65 74 |device==|NULL)ret|
|00002f70| 75 72 6e 20 30 3b 0d 09 | 63 6c 75 74 53 69 7a 65 |urn 0;..|clutSize|
|00002f80| 3d 47 44 43 6c 75 74 53 | 69 7a 65 28 63 61 72 64 |=GDClutS|ize(card|
|00002f90| 2d 3e 64 65 76 69 63 65 | 29 3b 0d 09 6e 6f 72 6d |->device|);..norm|
|00002fa0| 61 6c 54 61 62 6c 65 3d | 28 28 2a 2a 28 2a 2a 28 |alTable=|((**(**(|
|00002fb0| 2a 2a 63 61 72 64 2d 3e | 64 65 76 69 63 65 29 2e |**card->|device).|
|00002fc0| 67 64 50 4d 61 70 29 2e | 70 6d 54 61 62 6c 65 29 |gdPMap).|pmTable)|
|00002fd0| 29 2e 63 74 54 61 62 6c | 65 3b 0d 09 69 66 28 63 |).ctTabl|e;..if(c|
|00002fe0| 61 72 64 2d 3e 64 65 76 | 69 63 65 3d 3d 47 65 74 |ard->dev|ice==Get|
|00002ff0| 4d 61 69 6e 44 65 76 69 | 63 65 28 29 29 0d 09 09 |MainDevi|ce())...|
|00003000| 70 75 74 54 61 62 6c 65 | 3d 4d 61 6b 65 43 6c 75 |putTable|=MakeClu|
|00003010| 74 54 61 62 6c 65 28 63 | 61 72 64 2d 3e 64 65 76 |tTable(c|ard->dev|
|00003020| 69 63 65 2c 74 65 73 74 | 43 6c 75 74 4e 65 67 61 |ice,test|ClutNega|
|00003030| 74 69 76 65 46 6c 61 67 | 29 3b 0d 09 65 6c 73 65 |tiveFlag|);..else|
|00003040| 20 70 75 74 54 61 62 6c | 65 3d 4d 61 6b 65 43 6c | putTabl|e=MakeCl|
|00003050| 75 74 54 61 62 6c 65 28 | 63 61 72 64 2d 3e 64 65 |utTable(|card->de|
|00003060| 76 69 63 65 2c 66 6c 61 | 67 73 29 3b 0d 09 69 66 |vice,fla|gs);..if|
|00003070| 28 70 75 74 54 61 62 6c | 65 3d 3d 4e 55 4c 4c 29 |(putTabl|e==NULL)|
|00003080| 72 65 74 75 72 6e 20 4d | 65 6d 45 72 72 6f 72 28 |return M|emError(|
|00003090| 29 3b 0d 09 47 44 53 61 | 76 65 47 61 6d 6d 61 28 |);..GDSa|veGamma(|
|000030a0| 63 61 72 64 2d 3e 64 65 | 76 69 63 65 29 3b 0d 09 |card->de|vice);..|
|000030b0| 47 44 55 6e 63 6f 72 72 | 65 63 74 65 64 47 61 6d |GDUncorr|ectedGam|
|000030c0| 6d 61 28 63 61 72 64 2d | 3e 64 65 76 69 63 65 29 |ma(card-|>device)|
|000030d0| 3b 0d 09 65 72 72 6f 72 | 3d 57 72 69 74 65 43 6c |;..error|=WriteCl|
|000030e0| 75 74 28 63 61 72 64 2d | 3e 64 65 76 69 63 65 2c |ut(card-|>device,|
|000030f0| 70 75 74 54 61 62 6c 65 | 2c 66 6c 61 67 73 29 3b |putTable|,flags);|
|00003100| 0d 09 69 66 28 65 72 72 | 6f 72 29 7b 0d 09 09 47 |..if(err|or){...G|
|00003110| 44 52 65 73 74 6f 72 65 | 47 61 6d 6d 61 28 63 61 |DRestore|Gamma(ca|
|00003120| 72 64 2d 3e 64 65 76 69 | 63 65 29 3b 0d 09 09 47 |rd->devi|ce);...G|
|00003130| 44 52 65 73 74 6f 72 65 | 44 65 76 69 63 65 43 6c |DRestore|DeviceCl|
|00003140| 75 74 28 63 61 72 64 2d | 3e 64 65 76 69 63 65 29 |ut(card-|>device)|
|00003150| 3b 0d 09 09 72 65 74 75 | 72 6e 20 65 72 72 6f 72 |;...retu|rn error|
|00003160| 3b 0d 09 7d 0d 09 70 72 | 69 6e 74 66 28 42 4c 41 |;..}..pr|intf(BLA|
|00003170| 4e 4b 4c 49 4e 45 29 3b | 0d 09 70 72 69 6e 74 66 |NKLINE);|..printf|
|00003180| 28 22 53 63 72 65 65 6e | 20 73 68 6f 75 6c 64 20 |("Screen| should |
|00003190| 62 65 20 77 65 69 72 64 | 6c 79 20 63 6f 6c 6f 72 |be weird|ly color|
|000031a0| 65 64 3b 20 77 61 74 63 | 68 20 66 6f 72 20 73 75 |ed; watc|h for su|
|000031b0| 62 74 6c 65 20 63 68 61 | 6e 67 65 20 61 73 20 79 |btle cha|nge as y|
|000031c0| 6f 75 20 68 69 74 20 72 | 65 74 75 72 6e 3a 22 20 |ou hit r|eturn:" |
|000031d0| 22 5c 72 22 29 3b 0d 09 | 77 68 69 6c 65 28 67 65 |"\r");..|while(ge|
|000031e0| 74 63 68 61 72 55 6e 62 | 75 66 66 65 72 65 64 28 |tcharUnb|uffered(|
|000031f0| 29 3d 3d 2d 31 29 20 3b | 0d 09 65 72 72 6f 72 3d |)==-1) ;|..error=|
|00003200| 57 72 69 74 65 43 6c 75 | 74 28 63 61 72 64 2d 3e |WriteClu|t(card->|
|00003210| 64 65 76 69 63 65 2c 70 | 75 74 54 61 62 6c 65 2c |device,p|utTable,|
|00003220| 30 29 3b 0d 09 69 66 28 | 65 72 72 6f 72 29 7b 0d |0);..if(|error){.|
|00003230| 09 09 47 44 52 65 73 74 | 6f 72 65 47 61 6d 6d 61 |..GDRest|oreGamma|
|00003240| 28 63 61 72 64 2d 3e 64 | 65 76 69 63 65 29 3b 0d |(card->d|evice);.|
|00003250| 09 09 47 44 52 65 73 74 | 6f 72 65 44 65 76 69 63 |..GDRest|oreDevic|
|00003260| 65 43 6c 75 74 28 63 61 | 72 64 2d 3e 64 65 76 69 |eClut(ca|rd->devi|
|00003270| 63 65 29 3b 0d 09 09 72 | 65 74 75 72 6e 20 65 72 |ce);...r|eturn er|
|00003280| 72 6f 72 3b 0d 09 7d 0d | 09 70 72 69 6e 74 66 28 |ror;..}.|.printf(|
|00003290| 42 4c 41 4e 4b 4c 49 4e | 45 29 3b 0d 09 70 72 69 |BLANKLIN|E);..pri|
|000032a0| 6e 74 66 28 22 44 69 64 | 20 79 6f 75 20 73 65 65 |ntf("Did| you see|
|000032b0| 20 61 6e 79 20 63 68 61 | 6e 67 65 20 61 74 20 61 | any cha|nge at a|
|000032c0| 6c 6c 3f 22 29 3b 0d 09 | 77 65 69 72 64 45 72 72 |ll?");..|weirdErr|
|000032d0| 6f 72 3d 59 65 73 4f 72 | 4e 6f 28 30 29 3b 0d 09 |or=YesOr|No(0);..|
|000032e0| 70 72 69 6e 74 66 28 22 | 5c 72 22 29 3b 0d 09 65 |printf("|\r");..e|
|000032f0| 72 72 6f 72 3d 57 72 69 | 74 65 43 6c 75 74 28 63 |rror=Wri|teClut(c|
|00003300| 61 72 64 2d 3e 64 65 76 | 69 63 65 2c 6e 6f 72 6d |ard->dev|ice,norm|
|00003310| 61 6c 54 61 62 6c 65 2c | 66 6c 61 67 73 29 3b 0d |alTable,|flags);.|
|00003320| 09 70 72 69 6e 74 66 28 | 42 4c 41 4e 4b 4c 49 4e |.printf(|BLANKLIN|
|00003330| 45 29 3b 0d 09 70 72 69 | 6e 74 66 28 22 53 63 72 |E);..pri|ntf("Scr|
|00003340| 65 65 6e 20 73 68 6f 75 | 6c 64 20 62 65 20 6e 6f |een shou|ld be no|
|00003350| 72 6d 61 6c 20 6e 6f 77 | 3b 20 77 61 74 63 68 20 |rmal now|; watch |
|00003360| 66 6f 72 20 73 75 62 74 | 6c 65 20 63 68 61 6e 67 |for subt|le chang|
|00003370| 65 20 61 73 20 79 6f 75 | 20 68 69 74 20 72 65 74 |e as you| hit ret|
|00003380| 75 72 6e 3a 22 20 22 5c | 72 22 29 3b 0d 09 77 68 |urn:" "\|r");..wh|
|00003390| 69 6c 65 28 67 65 74 63 | 68 61 72 55 6e 62 75 66 |ile(getc|harUnbuf|
|000033a0| 66 65 72 65 64 28 29 3d | 3d 2d 31 29 20 3b 0d 09 |fered()=|=-1) ;..|
|000033b0| 65 72 72 6f 72 3d 57 72 | 69 74 65 43 6c 75 74 28 |error=Wr|iteClut(|
|000033c0| 63 61 72 64 2d 3e 64 65 | 76 69 63 65 2c 6e 6f 72 |card->de|vice,nor|
|000033d0| 6d 61 6c 54 61 62 6c 65 | 2c 30 29 3b 0d 09 70 72 |malTable|,0);..pr|
|000033e0| 69 6e 74 66 28 42 4c 41 | 4e 4b 4c 49 4e 45 29 3b |intf(BLA|NKLINE);|
|000033f0| 0d 09 70 72 69 6e 74 66 | 28 22 44 69 64 20 79 6f |..printf|("Did yo|
|00003400| 75 20 73 65 65 20 61 6e | 79 20 63 68 61 6e 67 65 |u see an|y change|
|00003410| 20 61 74 20 61 6c 6c 3f | 22 29 3b 0d 09 6e 6f 72 | at all?|");..nor|
|00003420| 6d 61 6c 45 72 72 6f 72 | 3d 59 65 73 4f 72 4e 6f |malError|=YesOrNo|
|00003430| 28 30 29 3b 0d 09 70 72 | 69 6e 74 66 28 22 5c 72 |(0);..pr|intf("\r|
|00003440| 22 29 3b 0d 09 47 44 52 | 65 73 74 6f 72 65 47 61 |");..GDR|estoreGa|
|00003450| 6d 6d 61 28 63 61 72 64 | 2d 3e 64 65 76 69 63 65 |mma(card|->device|
|00003460| 29 3b 0d 09 47 44 52 65 | 73 74 6f 72 65 44 65 76 |);..GDRe|storeDev|
|00003470| 69 63 65 43 6c 75 74 28 | 63 61 72 64 2d 3e 64 65 |iceClut(|card->de|
|00003480| 76 69 63 65 29 3b 0d 09 | 44 69 73 70 6f 73 65 50 |vice);..|DisposeP|
|00003490| 74 72 28 28 50 74 72 29 | 70 75 74 54 61 62 6c 65 |tr((Ptr)|putTable|
|000034a0| 29 3b 0d 09 63 6c 75 74 | 2d 3e 76 69 73 75 61 6c |);..clut|->visual|
|000034b0| 2e 74 65 73 74 65 64 2b | 2b 3b 0d 09 63 6c 75 74 |.tested+|+;..clut|
|000034c0| 2d 3e 76 69 73 75 61 6c | 2e 65 72 72 6f 72 73 2b |->visual|.errors+|
|000034d0| 3d 28 77 65 69 72 64 45 | 72 72 6f 72 20 7c 7c 20 |=(weirdE|rror || |
|000034e0| 6e 6f 72 6d 61 6c 45 72 | 72 6f 72 29 3b 0d 09 69 |normalEr|ror);..i|
|000034f0| 66 28 21 28 66 6c 61 67 | 73 26 74 65 73 74 43 6c |f(!(flag|s&testCl|
|00003500| 75 74 53 65 72 69 61 6c | 6c 79 46 6c 61 67 29 29 |utSerial|lyFlag))|
|00003510| 63 6c 75 74 2d 3e 76 69 | 73 75 61 6c 2e 65 72 72 |clut->vi|sual.err|
|00003520| 6f 72 73 41 74 4f 6e 63 | 65 2b 3d 28 77 65 69 72 |orsAtOnc|e+=(weir|
|00003530| 64 45 72 72 6f 72 20 7c | 7c 20 6e 6f 72 6d 61 6c |dError ||| normal|
|00003540| 45 72 72 6f 72 29 3b 0d | 09 72 65 74 75 72 6e 20 |Error);.|.return |
|00003550| 30 3b 0d 7d 0d 0d 43 6f | 6c 6f 72 53 70 65 63 20 |0;.}..Co|lorSpec |
|00003560| 2a 4d 61 6b 65 43 6c 75 | 74 54 61 62 6c 65 28 47 |*MakeClu|tTable(G|
|00003570| 44 48 61 6e 64 6c 65 20 | 64 65 76 69 63 65 2c 73 |DHandle |device,s|
|00003580| 68 6f 72 74 20 66 6c 61 | 67 73 29 0d 7b 0d 09 73 |hort fla|gs).{..s|
|00003590| 68 6f 72 74 20 69 2c 6a | 2c 63 6c 75 74 53 69 7a |hort i,j|,clutSiz|
|000035a0| 65 3b 0d 09 52 47 42 43 | 6f 6c 6f 72 20 70 75 74 |e;..RGBC|olor put|
|000035b0| 3b 0d 09 43 6f 6c 6f 72 | 53 70 65 63 20 2a 74 61 |;..Color|Spec *ta|
|000035c0| 62 6c 65 3b 0d 09 0d 09 | 63 6c 75 74 53 69 7a 65 |ble;....|clutSize|
|000035d0| 3d 47 44 43 6c 75 74 53 | 69 7a 65 28 64 65 76 69 |=GDClutS|ize(devi|
|000035e0| 63 65 29 3b 0d 09 69 66 | 28 28 66 6c 61 67 73 26 |ce);..if|((flags&|
|000035f0| 74 65 73 74 43 6c 75 74 | 47 61 69 6e 73 29 20 26 |testClut|Gains) &|
|00003600| 26 20 63 6c 75 74 53 69 | 7a 65 3c 31 36 29 63 6c |& clutSi|ze<16)cl|
|00003610| 75 74 53 69 7a 65 3d 31 | 36 3b 0d 09 74 61 62 6c |utSize=1|6;..tabl|
|00003620| 65 3d 28 43 6f 6c 6f 72 | 53 70 65 63 20 2a 29 4e |e=(Color|Spec *)N|
|00003630| 65 77 50 74 72 28 73 69 | 7a 65 6f 66 28 2a 74 61 |ewPtr(si|zeof(*ta|
|00003640| 62 6c 65 29 2a 63 6c 75 | 74 53 69 7a 65 29 3b 0d |ble)*clu|tSize);.|
|00003650| 09 69 66 28 74 61 62 6c | 65 3d 3d 4e 55 4c 4c 29 |.if(tabl|e==NULL)|
|00003660| 72 65 74 75 72 6e 20 74 | 61 62 6c 65 3b 0d 09 66 |return t|able;..f|
|00003670| 6f 72 28 69 3d 30 3b 69 | 3c 63 6c 75 74 53 69 7a |or(i=0;i|<clutSiz|
|00003680| 65 3b 69 2b 2b 29 20 7b | 0d 09 09 69 66 28 66 6c |e;i++) {|...if(fl|
|00003690| 61 67 73 26 74 65 73 74 | 43 6c 75 74 4e 65 67 61 |ags&test|ClutNega|
|000036a0| 74 69 76 65 46 6c 61 67 | 29 7b 0d 09 09 09 70 75 |tiveFlag|){....pu|
|000036b0| 74 3d 28 28 2a 2a 28 2a | 2a 28 2a 2a 64 65 76 69 |t=((**(*|*(**devi|
|000036c0| 63 65 29 2e 67 64 50 4d | 61 70 29 2e 70 6d 54 61 |ce).gdPM|ap).pmTa|
|000036d0| 62 6c 65 29 29 2e 63 74 | 54 61 62 6c 65 5b 63 6c |ble)).ct|Table[cl|
|000036e0| 75 74 53 69 7a 65 2d 31 | 2d 69 5d 2e 72 67 62 3b |utSize-1|-i].rgb;|
|000036f0| 0d 09 09 7d 65 6c 73 65 | 20 69 66 28 66 6c 61 67 |...}else| if(flag|
|00003700| 73 26 74 65 73 74 43 6c | 75 74 47 61 69 6e 73 29 |s&testCl|utGains)|
|00003710| 7b 0d 09 09 09 2f 2f 20 | 45 73 74 69 6d 61 74 65 |{....// |Estimate|
|00003720| 20 72 67 62 20 67 61 69 | 6e 73 20 6f 66 20 61 6e | rgb gai|ns of an|
|00003730| 79 20 74 72 61 6e 73 66 | 6f 72 6d 61 74 69 6f 6e |y transf|ormation|
|00003740| 0d 09 09 09 70 75 74 2e | 72 65 64 3d 70 75 74 2e |....put.|red=put.|
|00003750| 67 72 65 65 6e 3d 70 75 | 74 2e 62 6c 75 65 3d 30 |green=pu|t.blue=0|
|00003760| 3b 0d 09 09 09 6a 3d 28 | 30 78 66 66 66 66 4c 2a |;....j=(|0xffffL*|
|00003770| 69 2b 28 63 6c 75 74 53 | 69 7a 65 2d 31 29 2f 32 |i+(clutS|ize-1)/2|
|00003780| 29 2f 28 63 6c 75 74 53 | 69 7a 65 2d 31 29 3b 0d |)/(clutS|ize-1);.|
|00003790| 09 09 09 73 77 69 74 63 | 68 28 69 25 33 29 7b 0d |...switc|h(i%3){.|
|000037a0| 09 09 09 63 61 73 65 20 | 30 3a 0d 09 09 09 09 70 |...case |0:.....p|
|000037b0| 75 74 2e 72 65 64 3d 6a | 3b 0d 09 09 09 09 62 72 |ut.red=j|;.....br|
|000037c0| 65 61 6b 3b 0d 09 09 09 | 63 61 73 65 20 31 3a 0d |eak;....|case 1:.|
|000037d0| 09 09 09 09 70 75 74 2e | 67 72 65 65 6e 3d 6a 3b |....put.|green=j;|
|000037e0| 0d 09 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 09 63 |.....bre|ak;....c|
|000037f0| 61 73 65 20 32 3a 0d 09 | 09 09 09 70 75 74 2e 62 |ase 2:..|...put.b|
|00003800| 6c 75 65 3d 6a 3b 0d 09 | 09 09 09 62 72 65 61 6b |lue=j;..|...break|
|00003810| 3b 0d 09 09 09 7d 0d 09 | 09 7d 65 6c 73 65 20 69 |;....}..|.}else i|
|00003820| 66 28 66 6c 61 67 73 26 | 74 65 73 74 43 6c 75 74 |f(flags&|testClut|
|00003830| 4c 69 6e 65 61 72 46 6c | 61 67 29 7b 0d 09 09 09 |LinearFl|ag){....|
|00003840| 2f 2f 20 4c 69 6e 65 61 | 72 20 74 65 73 74 20 70 |// Linea|r test p|
|00003850| 61 74 74 65 72 6e 0d 09 | 09 09 70 75 74 2e 72 65 |attern..|..put.re|
|00003860| 64 3d 70 75 74 2e 67 72 | 65 65 6e 3d 70 75 74 2e |d=put.gr|een=put.|
|00003870| 62 6c 75 65 3d 30 3b 0d | 09 09 09 6a 3d 30 78 66 |blue=0;.|...j=0xf|
|00003880| 66 66 66 66 66 66 66 2a | 28 69 2b 28 63 6c 75 74 |fffffff*|(i+(clut|
|00003890| 53 69 7a 65 2d 31 29 2f | 32 29 2f 28 63 6c 75 74 |Size-1)/|2)/(clut|
|000038a0| 53 69 7a 65 2d 31 29 3b | 0d 09 09 09 73 77 69 74 |Size-1);|....swit|
|000038b0| 63 68 28 69 25 34 29 7b | 0d 09 09 09 63 61 73 65 |ch(i%4){|....case|
|000038c0| 20 30 3a 0d 09 09 09 09 | 70 75 74 2e 72 65 64 3d | 0:.....|put.red=|
|000038d0| 70 75 74 2e 67 72 65 65 | 6e 3d 70 75 74 2e 62 6c |put.gree|n=put.bl|
|000038e0| 75 65 3d 6a 3b 0d 09 09 | 09 09 62 72 65 61 6b 3b |ue=j;...|..break;|
|000038f0| 0d 09 09 09 63 61 73 65 | 20 31 3a 0d 09 09 09 09 |....case| 1:.....|
|00003900| 70 75 74 2e 72 65 64 3d | 6a 3b 0d 09 09 09 09 62 |put.red=|j;.....b|
|00003910| 72 65 61 6b 3b 0d 09 09 | 09 63 61 73 65 20 32 3a |reak;...|.case 2:|
|00003920| 0d 09 09 09 09 70 75 74 | 2e 67 72 65 65 6e 3d 6a |.....put|.green=j|
|00003930| 3b 0d 09 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 09 |;.....br|eak;....|
|00003940| 63 61 73 65 20 33 3a 0d | 09 09 09 09 70 75 74 2e |case 3:.|....put.|
|00003950| 62 6c 75 65 3d 6a 3b 0d | 09 09 09 09 62 72 65 61 |blue=j;.|....brea|
|00003960| 6b 3b 0d 09 09 09 7d 0d | 09 09 7d 65 6c 73 65 7b |k;....}.|..}else{|
|00003970| 0d 09 09 09 2f 2f 20 52 | 61 6e 64 6f 6d 20 74 65 |....// R|andom te|
|00003980| 73 74 20 70 61 74 74 65 | 72 6e 0d 09 09 09 70 75 |st patte|rn....pu|
|00003990| 74 2e 72 65 64 3d 72 61 | 6e 64 55 28 29 3b 0d 09 |t.red=ra|ndU();..|
|000039a0| 09 09 70 75 74 2e 67 72 | 65 65 6e 3d 72 61 6e 64 |..put.gr|een=rand|
|000039b0| 55 28 29 3b 0d 09 09 09 | 70 75 74 2e 62 6c 75 65 |U();....|put.blue|
|000039c0| 3d 72 61 6e 64 55 28 29 | 3b 0d 09 09 7d 0d 09 09 |=randU()|;...}...|
|000039d0| 69 66 28 21 53 69 78 74 | 65 65 6e 42 69 74 47 72 |if(!Sixt|eenBitGr|
|000039e0| 61 79 29 7b 0d 09 09 09 | 70 75 74 2e 72 65 64 26 |ay){....|put.red&|
|000039f0| 3d 30 78 66 66 30 30 3b | 0d 09 09 09 70 75 74 2e |=0xff00;|....put.|
|00003a00| 67 72 65 65 6e 26 3d 30 | 78 66 66 30 30 3b 0d 09 |green&=0|xff00;..|
|00003a10| 09 09 70 75 74 2e 62 6c | 75 65 26 3d 30 78 66 66 |..put.bl|ue&=0xff|
|00003a20| 30 30 3b 0d 09 09 7d 0d | 09 09 74 61 62 6c 65 5b |00;...}.|..table[|
|00003a30| 69 5d 2e 72 67 62 3d 70 | 75 74 3b 0d 09 7d 0d 09 |i].rgb=p|ut;..}..|
|00003a40| 72 65 74 75 72 6e 20 74 | 61 62 6c 65 3b 0d 7d 0d |return t|able;.}.|
|00003a50| 0d 4f 53 45 72 72 20 57 | 72 69 74 65 43 6c 75 74 |.OSErr W|riteClut|
|00003a60| 28 47 44 48 61 6e 64 6c | 65 20 64 65 76 69 63 65 |(GDHandl|e device|
|00003a70| 2c 43 6f 6c 6f 72 53 70 | 65 63 20 70 75 74 54 61 |,ColorSp|ec putTa|
|00003a80| 62 6c 65 5b 5d 2c 73 68 | 6f 72 74 20 66 6c 61 67 |ble[],sh|ort flag|
|00003a90| 73 29 0d 7b 0d 09 73 68 | 6f 72 74 20 69 2c 63 6c |s).{..sh|ort i,cl|
|00003aa0| 75 74 53 69 7a 65 3d 47 | 44 43 6c 75 74 53 69 7a |utSize=G|DClutSiz|
|00003ab0| 65 28 64 65 76 69 63 65 | 29 3b 0d 09 63 68 61 72 |e(device|);..char|
|00003ac0| 20 70 72 69 6f 72 69 74 | 79 3d 37 3b 0d 09 69 6e | priorit|y=7;..in|
|00003ad0| 74 20 65 72 72 6f 72 3b | 0d 09 53 65 74 45 6e 74 |t error;|..SetEnt|
|00003ae0| 72 69 65 73 46 75 6e 63 | 74 69 6f 6e 20 66 75 6e |riesFunc|tion fun|
|00003af0| 63 74 69 6f 6e 3b 0d 09 | 09 0d 09 69 66 28 66 6c |ction;..|...if(fl|
|00003b00| 61 67 73 26 74 65 73 74 | 43 6c 75 74 51 75 69 63 |ags&test|ClutQuic|
|00003b10| 6b 6c 79 46 6c 61 67 29 | 66 75 6e 63 74 69 6f 6e |klyFlag)|function|
|00003b20| 3d 53 65 74 45 6e 74 72 | 69 65 73 51 75 69 63 6b |=SetEntr|iesQuick|
|00003b30| 6c 79 3b 0d 09 65 6c 73 | 65 20 66 75 6e 63 74 69 |ly;..els|e functi|
|00003b40| 6f 6e 3d 47 44 53 65 74 | 45 6e 74 72 69 65 73 42 |on=GDSet|EntriesB|
|00003b50| 79 54 79 70 65 3b 0d 09 | 69 66 28 66 6c 61 67 73 |yType;..|if(flags|
|00003b60| 26 74 65 73 74 43 6c 75 | 74 53 65 72 69 61 6c 6c |&testClu|tSeriall|
|00003b70| 79 46 6c 61 67 29 7b 0d | 09 09 2f 2f 20 4c 6f 61 |yFlag){.|..// Loa|
|00003b80| 64 20 6f 6e 65 20 63 6c | 75 74 20 65 6e 74 72 79 |d one cl|ut entry|
|00003b90| 20 61 74 20 61 20 74 69 | 6d 65 0d 09 09 66 6f 72 | at a ti|me...for|
|00003ba0| 28 69 3d 30 3b 69 3c 63 | 6c 75 74 53 69 7a 65 3b |(i=0;i<c|lutSize;|
|00003bb0| 69 2b 2b 29 7b 0d 09 09 | 09 53 77 61 70 50 72 69 |i++){...|.SwapPri|
|00003bc0| 6f 72 69 74 79 28 26 70 | 72 69 6f 72 69 74 79 29 |ority(&p|riority)|
|00003bd0| 3b 09 2f 2f 20 46 6f 72 | 63 65 20 64 72 69 76 65 |;.// For|ce drive|
|00003be0| 72 20 74 6f 20 6c 6f 61 | 64 20 63 6c 75 74 20 6e |r to loa|d clut n|
|00003bf0| 6f 77 2e 0d 09 09 09 65 | 72 72 6f 72 3d 28 66 75 |ow.....e|rror=(fu|
|00003c00| 6e 63 74 69 6f 6e 29 28 | 64 65 76 69 63 65 2c 69 |nction)(|device,i|
|00003c10| 2c 30 2c 26 70 75 74 54 | 61 62 6c 65 5b 69 5d 29 |,0,&putT|able[i])|
|00003c20| 3b 0d 09 09 09 53 77 61 | 70 50 72 69 6f 72 69 74 |;....Swa|pPriorit|
|00003c30| 79 28 26 70 72 69 6f 72 | 69 74 79 29 3b 0d 09 09 |y(&prior|ity);...|
|00003c40| 09 69 66 28 65 72 72 6f | 72 29 72 65 74 75 72 6e |.if(erro|r)return|
|00003c50| 20 65 72 72 6f 72 3b 0d | 09 09 7d 0d 09 7d 65 6c | error;.|..}..}el|
|00003c60| 73 65 7b 0d 09 09 2f 2f | 20 4c 6f 61 64 20 77 68 |se{...//| Load wh|
|00003c70| 6f 6c 65 20 63 6c 75 74 | 20 61 74 20 6f 6e 63 65 |ole clut| at once|
|00003c80| 0d 09 09 53 77 61 70 50 | 72 69 6f 72 69 74 79 28 |...SwapP|riority(|
|00003c90| 26 70 72 69 6f 72 69 74 | 79 29 3b 09 2f 2f 20 46 |&priorit|y);.// F|
|00003ca0| 6f 72 63 65 20 64 72 69 | 76 65 72 20 74 6f 20 6c |orce dri|ver to l|
|00003cb0| 6f 61 64 20 63 6c 75 74 | 20 6e 6f 77 2e 0d 09 09 |oad clut| now....|
|00003cc0| 65 72 72 6f 72 3d 28 66 | 75 6e 63 74 69 6f 6e 29 |error=(f|unction)|
|00003cd0| 28 64 65 76 69 63 65 2c | 30 2c 63 6c 75 74 53 69 |(device,|0,clutSi|
|00003ce0| 7a 65 2d 31 2c 70 75 74 | 54 61 62 6c 65 29 3b 0d |ze-1,put|Table);.|
|00003cf0| 09 09 53 77 61 70 50 72 | 69 6f 72 69 74 79 28 26 |..SwapPr|iority(&|
|00003d00| 70 72 69 6f 72 69 74 79 | 29 3b 0d 09 09 69 66 28 |priority|);...if(|
|00003d10| 65 72 72 6f 72 29 72 65 | 74 75 72 6e 20 65 72 72 |error)re|turn err|
|00003d20| 6f 72 3b 0d 09 7d 0d 09 | 72 65 74 75 72 6e 20 30 |or;..}..|return 0|
|00003d30| 3b 0d 7d 0d 0d 4f 53 45 | 72 72 20 47 44 54 65 73 |;.}..OSE|rr GDTes|
|00003d40| 74 43 6c 75 74 48 61 73 | 68 28 73 68 6f 72 74 20 |tClutHas|h(short |
|00003d50| 66 6c 61 67 73 2c 56 69 | 64 65 6f 49 6e 66 6f 20 |flags,Vi|deoInfo |
|00003d60| 2a 63 61 72 64 29 7b 0d | 09 53 65 74 45 6e 74 72 |*card){.|.SetEntr|
|00003d70| 69 65 73 46 75 6e 63 74 | 69 6f 6e 20 66 75 6e 63 |iesFunct|ion func|
|00003d80| 74 69 6f 6e 3b 0d 09 69 | 6e 74 20 65 72 72 6f 72 |tion;..i|nt error|
|00003d90| 3b 0d 09 73 68 6f 72 74 | 20 69 73 47 72 61 79 2c |;..short| isGray,|
|00003da0| 71 75 69 63 6b 6c 79 3b | 0d 09 56 69 64 65 6f 43 |quickly;|..VideoC|
|00003db0| 61 72 64 43 6c 75 74 54 | 65 73 74 20 2a 63 6c 75 |ardClutT|est *clu|
|00003dc0| 74 3b 0d 09 0d 09 69 66 | 28 63 61 72 64 2d 3e 64 |t;....if|(card->d|
|00003dd0| 65 76 69 63 65 3d 3d 4e | 55 4c 4c 29 72 65 74 75 |evice==N|ULL)retu|
|00003de0| 72 6e 20 30 3b 0d 09 71 | 75 69 63 6b 6c 79 3d 28 |rn 0;..q|uickly=(|
|00003df0| 28 66 6c 61 67 73 26 74 | 65 73 74 43 6c 75 74 51 |(flags&t|estClutQ|
|00003e00| 75 69 63 6b 6c 79 46 6c | 61 67 29 21 3d 30 29 3b |uicklyFl|ag)!=0);|
|00003e10| 0d 09 69 73 47 72 61 79 | 3d 21 54 65 73 74 44 65 |..isGray|=!TestDe|
|00003e20| 76 69 63 65 41 74 74 72 | 69 62 75 74 65 28 63 61 |viceAttr|ibute(ca|
|00003e30| 72 64 2d 3e 64 65 76 69 | 63 65 2c 67 64 44 65 76 |rd->devi|ce,gdDev|
|00003e40| 54 79 70 65 29 3b 0d 09 | 63 6c 75 74 3d 26 63 61 |Type);..|clut=&ca|
|00003e50| 72 64 2d 3e 64 65 70 74 | 68 5b 63 61 72 64 2d 3e |rd->dept|h[card->|
|00003e60| 64 5d 2e 63 6c 75 74 5b | 71 75 69 63 6b 6c 79 5d |d].clut[|quickly]|
|00003e70| 5b 69 73 47 72 61 79 5d | 3b 0d 09 69 66 28 63 6c |[isGray]|;..if(cl|
|00003e80| 75 74 2d 3e 68 61 73 68 | 2e 74 65 73 74 65 64 3d |ut->hash|.tested=|
|00003e90| 3d 30 29 63 6c 75 74 2d | 3e 68 61 73 68 2e 65 72 |=0)clut-|>hash.er|
|00003ea0| 72 6f 72 73 3d 30 3b 0d | 09 69 66 28 21 63 6c 75 |rors=0;.|.if(!clu|
|00003eb0| 74 2d 3e 68 61 73 68 2e | 64 6f 54 65 73 74 29 72 |t->hash.|doTest)r|
|00003ec0| 65 74 75 72 6e 20 30 3b | 0d 09 69 66 28 71 75 69 |eturn 0;|..if(qui|
|00003ed0| 63 6b 6c 79 29 66 75 6e | 63 74 69 6f 6e 3d 53 65 |ckly)fun|ction=Se|
|00003ee0| 74 45 6e 74 72 69 65 73 | 51 75 69 63 6b 6c 79 3b |tEntries|Quickly;|
|00003ef0| 0d 09 65 6c 73 65 20 66 | 75 6e 63 74 69 6f 6e 3d |..else f|unction=|
|00003f00| 47 44 53 65 74 45 6e 74 | 72 69 65 73 42 79 54 79 |GDSetEnt|riesByTy|
|00003f10| 70 65 3b 0d 09 65 72 72 | 6f 72 3d 56 69 73 69 62 |pe;..err|or=Visib|
|00003f20| 6c 65 48 61 73 68 28 63 | 61 72 64 2d 3e 64 65 76 |leHash(c|ard->dev|
|00003f30| 69 63 65 2c 66 75 6e 63 | 74 69 6f 6e 2c 30 2c 26 |ice,func|tion,0,&|
|00003f40| 63 6c 75 74 2d 3e 68 61 | 73 68 2e 65 72 72 6f 72 |clut->ha|sh.error|
|00003f50| 73 29 3b 0d 09 63 6c 75 | 74 2d 3e 68 61 73 68 2e |s);..clu|t->hash.|
|00003f60| 74 65 73 74 65 64 3d 31 | 3b 0d 09 72 65 74 75 72 |tested=1|;..retur|
|00003f70| 6e 20 65 72 72 6f 72 3b | 0d 7d 0d 0d 4f 53 45 72 |n error;|.}..OSEr|
|00003f80| 72 20 56 69 73 69 62 6c | 65 48 61 73 68 28 47 44 |r Visibl|eHash(GD|
|00003f90| 48 61 6e 64 6c 65 20 64 | 65 76 69 63 65 2c 53 65 |Handle d|evice,Se|
|00003fa0| 74 45 6e 74 72 69 65 73 | 46 75 6e 63 74 69 6f 6e |tEntries|Function|
|00003fb0| 20 66 75 6e 63 74 69 6f | 6e 2c 73 68 6f 72 74 20 | functio|n,short |
|00003fc0| 63 6c 75 74 45 6e 74 72 | 69 65 73 0d 09 2c 73 68 |clutEntr|ies..,sh|
|00003fd0| 6f 72 74 20 2a 68 61 73 | 68 50 74 72 29 0d 7b 0d |ort *has|hPtr).{.|
|00003fe0| 09 69 6e 74 20 65 72 72 | 6f 72 3b 0d 09 73 68 6f |.int err|or;..sho|
|00003ff0| 72 74 20 63 6c 75 74 53 | 69 7a 65 3b 0d 09 73 68 |rt clutS|ize;..sh|
|00004000| 6f 72 74 20 68 61 73 68 | 3b 0d 09 6c 6f 6e 67 20 |ort hash|;..long |
|00004010| 74 69 63 6b 3b 0d 09 43 | 6f 6c 6f 72 53 70 65 63 |tick;..C|olorSpec|
|00004020| 20 2a 70 75 74 54 61 62 | 6c 65 2c 2a 6c 69 6e 65 | *putTab|le,*line|
|00004030| 61 72 54 61 62 6c 65 3d | 4e 55 4c 4c 3b 0d 0d 09 |arTable=|NULL;...|
|00004040| 69 66 28 64 65 76 69 63 | 65 3d 3d 4e 55 4c 4c 20 |if(devic|e==NULL |
|00004050| 7c 7c 20 28 2a 2a 64 65 | 76 69 63 65 29 2e 67 64 ||| (**de|vice).gd|
|00004060| 54 79 70 65 3d 3d 66 69 | 78 65 64 54 79 70 65 29 |Type==fi|xedType)|
|00004070| 72 65 74 75 72 6e 20 30 | 3b 0d 09 63 6c 75 74 53 |return 0|;..clutS|
|00004080| 69 7a 65 3d 47 44 43 6c | 75 74 53 69 7a 65 28 64 |ize=GDCl|utSize(d|
|00004090| 65 76 69 63 65 29 3b 0d | 09 69 66 28 63 6c 75 74 |evice);.|.if(clut|
|000040a0| 45 6e 74 72 69 65 73 3c | 30 20 7c 7c 20 63 6c 75 |Entries<|0 || clu|
|000040b0| 74 45 6e 74 72 69 65 73 | 3e 63 6c 75 74 53 69 7a |tEntries|>clutSiz|
|000040c0| 65 29 72 65 74 75 72 6e | 20 31 3b 0d 09 69 66 28 |e)return| 1;..if(|
|000040d0| 63 6c 75 74 45 6e 74 72 | 69 65 73 3d 3d 30 29 63 |clutEntr|ies==0)c|
|000040e0| 6c 75 74 45 6e 74 72 69 | 65 73 3d 63 6c 75 74 53 |lutEntri|es=clutS|
|000040f0| 69 7a 65 3b 0d 09 69 66 | 28 28 2a 2a 64 65 76 69 |ize;..if|((**devi|
|00004100| 63 65 29 2e 67 64 54 79 | 70 65 3d 3d 64 69 72 65 |ce).gdTy|pe==dire|
|00004110| 63 74 54 79 70 65 29 7b | 0d 09 09 69 66 28 66 75 |ctType){|...if(fu|
|00004120| 6e 63 74 69 6f 6e 3d 3d | 47 44 53 65 74 45 6e 74 |nction==|GDSetEnt|
|00004130| 72 69 65 73 29 66 75 6e | 63 74 69 6f 6e 3d 47 44 |ries)fun|ction=GD|
|00004140| 44 69 72 65 63 74 53 65 | 74 45 6e 74 72 69 65 73 |DirectSe|tEntries|
|00004150| 3b 0d 09 09 70 75 74 54 | 61 62 6c 65 3d 6c 69 6e |;...putT|able=lin|
|00004160| 65 61 72 54 61 62 6c 65 | 3d 47 44 4e 65 77 4c 69 |earTable|=GDNewLi|
|00004170| 6e 65 61 72 43 6f 6c 6f | 72 54 61 62 6c 65 28 64 |nearColo|rTable(d|
|00004180| 65 76 69 63 65 29 3b 0d | 09 09 69 66 28 6c 69 6e |evice);.|..if(lin|
|00004190| 65 61 72 54 61 62 6c 65 | 3d 3d 4e 55 4c 4c 29 72 |earTable|==NULL)r|
|000041a0| 65 74 75 72 6e 20 4d 65 | 6d 45 72 72 6f 72 28 29 |eturn Me|mError()|
|000041b0| 3b 0d 09 7d 65 6c 73 65 | 20 70 75 74 54 61 62 6c |;..}else| putTabl|
|000041c0| 65 3d 28 28 2a 2a 28 2a | 2a 28 2a 2a 64 65 76 69 |e=((**(*|*(**devi|
|000041d0| 63 65 29 2e 67 64 50 4d | 61 70 29 2e 70 6d 54 61 |ce).gdPM|ap).pmTa|
|000041e0| 62 6c 65 29 29 2e 63 74 | 54 61 62 6c 65 3b 0d 09 |ble)).ct|Table;..|
|000041f0| 65 72 72 6f 72 3d 28 66 | 75 6e 63 74 69 6f 6e 29 |error=(f|unction)|
|00004200| 28 64 65 76 69 63 65 2c | 30 2c 63 6c 75 74 45 6e |(device,|0,clutEn|
|00004210| 74 72 69 65 73 2d 31 2c | 70 75 74 54 61 62 6c 65 |tries-1,|putTable|
|00004220| 29 3b 0d 09 69 66 28 21 | 65 72 72 6f 72 29 7b 0d |);..if(!|error){.|
|00004230| 09 09 70 72 69 6e 74 66 | 28 42 4c 41 4e 4b 4c 49 |..printf|(BLANKLI|
|00004240| 4e 45 29 3b 0d 09 09 69 | 66 28 64 65 76 69 63 65 |NE);...i|f(device|
|00004250| 3d 3d 47 65 74 4d 61 69 | 6e 44 65 76 69 63 65 28 |==GetMai|nDevice(|
|00004260| 29 29 0d 09 09 09 70 72 | 69 6e 74 66 28 22 44 6f |))....pr|intf("Do|
|00004270| 20 79 6f 75 20 73 65 65 | 20 61 6e 79 20 64 79 6e | you see| any dyn|
|00004280| 61 6d 69 63 20 62 6c 61 | 63 6b 20 73 70 65 63 6b |amic bla|ck speck|
|00004290| 73 20 6f 6e 20 74 68 69 | 73 20 73 63 72 65 65 6e |s on thi|s screen|
|000042a0| 3f 20 28 4e 6f 29 3a 22 | 29 3b 0d 09 09 65 6c 73 |? (No):"|);...els|
|000042b0| 65 20 70 72 69 6e 74 66 | 28 22 44 6f 20 79 6f 75 |e printf|("Do you|
|000042c0| 20 73 65 65 20 61 6e 79 | 20 64 79 6e 61 6d 69 63 | see any| dynamic|
|000042d0| 20 62 6c 61 63 6b 20 73 | 70 65 63 6b 73 20 6f 6e | black s|pecks on|
|000042e0| 20 74 68 65 20 74 65 73 | 74 20 73 63 72 65 65 6e | the tes|t screen|
|000042f0| 3f 20 28 4e 6f 29 3a 22 | 29 3b 0d 09 09 66 66 6c |? (No):"|);...ffl|
|00004300| 75 73 68 28 73 74 64 6f | 75 74 29 3b 0d 09 09 64 |ush(stdo|ut);...d|
|00004310| 6f 7b 0d 09 09 09 74 69 | 63 6b 3d 54 69 63 6b 43 |o{....ti|ck=TickC|
|00004320| 6f 75 6e 74 28 29 3b 0d | 09 09 09 64 6f 7b 0d 09 |ount();.|...do{..|
|00004330| 09 09 09 28 66 75 6e 63 | 74 69 6f 6e 29 28 64 65 |...(func|tion)(de|
|00004340| 76 69 63 65 2c 30 2c 63 | 6c 75 74 45 6e 74 72 69 |vice,0,c|lutEntri|
|00004350| 65 73 2d 31 2c 70 75 74 | 54 61 62 6c 65 29 3b 0d |es-1,put|Table);.|
|00004360| 09 09 09 7d 77 68 69 6c | 65 28 54 69 63 6b 43 6f |...}whil|e(TickCo|
|00004370| 75 6e 74 28 29 2d 74 69 | 63 6b 3c 33 30 29 3b 0d |unt()-ti|ck<30);.|
|00004380| 09 09 7d 77 68 69 6c 65 | 28 21 6b 62 68 69 74 28 |..}while|(!kbhit(|
|00004390| 29 29 3b 0d 09 09 68 61 | 73 68 3d 59 65 73 4f 72 |));...ha|sh=YesOr|
|000043a0| 4e 6f 28 30 29 3b 0d 09 | 09 70 72 69 6e 74 66 28 |No(0);..|.printf(|
|000043b0| 22 5c 72 22 29 3b 0d 09 | 09 69 66 28 6c 69 6e 65 |"\r");..|.if(line|
|000043c0| 61 72 54 61 62 6c 65 21 | 3d 4e 55 4c 4c 29 44 69 |arTable!|=NULL)Di|
|000043d0| 73 70 6f 73 65 50 74 72 | 28 28 50 74 72 29 6c 69 |sposePtr|((Ptr)li|
|000043e0| 6e 65 61 72 54 61 62 6c | 65 29 3b 0d 09 09 69 66 |nearTabl|e);...if|
|000043f0| 28 68 61 73 68 50 74 72 | 21 3d 4e 55 4c 4c 29 2a |(hashPtr|!=NULL)*|
|00004400| 68 61 73 68 50 74 72 3d | 68 61 73 68 3b 0d 09 7d |hashPtr=|hash;..}|
|00004410| 0d 09 72 65 74 75 72 6e | 20 65 72 72 6f 72 3b 0d |..return| error;.|
|00004420| 7d 0d 0d 76 6f 69 64 20 | 47 44 52 65 73 74 6f 72 |}..void |GDRestor|
|00004430| 65 42 6c 61 63 6b 41 6e | 64 57 68 69 74 65 28 47 |eBlackAn|dWhite(G|
|00004440| 44 48 61 6e 64 6c 65 20 | 64 65 76 69 63 65 29 0d |DHandle |device).|
|00004450| 2f 2f 20 52 65 73 74 6f | 72 65 20 74 68 65 20 66 |// Resto|re the f|
|00004460| 69 72 73 74 20 26 20 6c | 61 73 74 20 63 6c 75 74 |irst & l|ast clut|
|00004470| 20 65 6e 74 72 69 65 73 | 20 74 6f 20 77 68 69 74 | entries| to whit|
|00004480| 65 20 61 6e 64 20 62 6c | 61 63 6b 2e 0d 7b 0d 09 |e and bl|ack..{..|
|00004490| 73 68 6f 72 74 20 63 6c | 75 74 53 69 7a 65 3b 0d |short cl|utSize;.|
|000044a0| 09 69 6e 74 20 65 72 72 | 6f 72 3b 0d 09 43 6f 6c |.int err|or;..Col|
|000044b0| 6f 72 53 70 65 63 20 77 | 68 69 74 65 3d 7b 32 35 |orSpec w|hite={25|
|000044c0| 35 2c 30 78 66 66 66 66 | 2c 30 78 66 66 66 66 2c |5,0xffff|,0xffff,|
|000044d0| 30 78 66 66 66 66 7d 2c | 62 6c 61 63 6b 3d 7b 30 |0xffff},|black={0|
|000044e0| 2c 30 2c 30 2c 30 7d 3b | 0d 0d 09 63 6c 75 74 53 |,0,0,0};|...clutS|
|000044f0| 69 7a 65 3d 47 44 43 6c | 75 74 53 69 7a 65 28 64 |ize=GDCl|utSize(d|
|00004500| 65 76 69 63 65 29 3b 0d | 09 73 77 69 74 63 68 28 |evice);.|.switch(|
|00004510| 28 2a 2a 64 65 76 69 63 | 65 29 2e 67 64 54 79 70 |(**devic|e).gdTyp|
|00004520| 65 29 7b 0d 09 63 61 73 | 65 20 63 6c 75 74 54 79 |e){..cas|e clutTy|
|00004530| 70 65 3a 0d 09 09 65 72 | 72 6f 72 3d 47 44 53 65 |pe:...er|ror=GDSe|
|00004540| 74 45 6e 74 72 69 65 73 | 28 64 65 76 69 63 65 2c |tEntries|(device,|
|00004550| 30 2c 30 2c 26 77 68 69 | 74 65 29 3b 0d 09 09 65 |0,0,&whi|te);...e|
|00004560| 72 72 6f 72 3d 47 44 53 | 65 74 45 6e 74 72 69 65 |rror=GDS|etEntrie|
|00004570| 73 28 64 65 76 69 63 65 | 2c 63 6c 75 74 53 69 7a |s(device|,clutSiz|
|00004580| 65 2d 31 2c 30 2c 26 62 | 6c 61 63 6b 2d 28 63 6c |e-1,0,&b|lack-(cl|
|00004590| 75 74 53 69 7a 65 2d 31 | 29 29 3b 0d 09 09 62 72 |utSize-1|));...br|
|000045a0| 65 61 6b 3b 0d 09 63 61 | 73 65 20 64 69 72 65 63 |eak;..ca|se direc|
|000045b0| 74 54 79 70 65 3a 0d 09 | 09 65 72 72 6f 72 3d 47 |tType:..|.error=G|
|000045c0| 44 44 69 72 65 63 74 53 | 65 74 45 6e 74 72 69 65 |DDirectS|etEntrie|
|000045d0| 73 28 64 65 76 69 63 65 | 2c 30 2c 30 2c 26 62 6c |s(device|,0,0,&bl|
|000045e0| 61 63 6b 29 3b 0d 09 09 | 65 72 72 6f 72 3d 47 44 |ack);...|error=GD|
|000045f0| 44 69 72 65 63 74 53 65 | 74 45 6e 74 72 69 65 73 |DirectSe|tEntries|
|00004600| 28 64 65 76 69 63 65 2c | 63 6c 75 74 53 69 7a 65 |(device,|clutSize|
|00004610| 2d 31 2c 30 2c 26 77 68 | 69 74 65 2d 28 63 6c 75 |-1,0,&wh|ite-(clu|
|00004620| 74 53 69 7a 65 2d 31 29 | 29 3b 0d 09 09 62 72 65 |tSize-1)|);...bre|
|00004630| 61 6b 3b 0d 09 64 65 66 | 61 75 6c 74 3a 0d 09 09 |ak;..def|ault:...|
|00004640| 62 72 65 61 6b 3b 0d 09 | 7d 0d 7d 0d 42 6f 6f 6c |break;..|}.}.Bool|
|00004650| 65 61 6e 20 55 6e 65 71 | 75 61 6c 43 6c 75 74 45 |ean Uneq|ualClutE|
|00004660| 6e 74 72 79 28 52 47 42 | 43 6f 6c 6f 72 20 2a 61 |ntry(RGB|Color *a|
|00004670| 2c 52 47 42 43 6f 6c 6f | 72 20 2a 62 2c 73 68 6f |,RGBColo|r *b,sho|
|00004680| 72 74 20 6d 61 73 6b 29 | 0d 7b 0d 09 72 65 74 75 |rt mask)|.{..retu|
|00004690| 72 6e 20 28 61 2d 3e 72 | 65 64 26 6d 61 73 6b 29 |rn (a->r|ed&mask)|
|000046a0| 21 3d 28 62 2d 3e 72 65 | 64 26 6d 61 73 6b 29 0d |!=(b->re|d&mask).|
|000046b0| 09 09 7c 7c 28 61 2d 3e | 67 72 65 65 6e 26 6d 61 |..||(a->|green&ma|
|000046c0| 73 6b 29 21 3d 28 62 2d | 3e 67 72 65 65 6e 26 6d |sk)!=(b-|>green&m|
|000046d0| 61 73 6b 29 0d 09 09 7c | 7c 28 61 2d 3e 62 6c 75 |ask)...|||(a->blu|
|000046e0| 65 26 6d 61 73 6b 29 21 | 3d 28 62 2d 3e 62 6c 75 |e&mask)!|=(b->blu|
|000046f0| 65 26 6d 61 73 6b 29 3b | 0d 7d 0d 0d 2f 2a 0d 57 |e&mask);|.}../*.W|
|00004700| 68 65 6e 20 79 6f 75 20 | 73 65 74 20 61 20 76 69 |hen you |set a vi|
|00004710| 64 65 6f 20 73 63 72 65 | 65 6e 20 74 6f 20 6d 6f |deo scre|en to mo|
|00004720| 6e 6f 63 68 72 6f 6d 65 | 20 6f 72 20 22 67 72 61 |nochrome| or "gra|
|00004730| 79 22 20 28 61 73 20 6f | 70 70 6f 73 65 64 20 74 |y" (as o|pposed t|
|00004740| 6f 20 22 63 6f 6c 6f 72 | 22 29 2c 0d 65 2e 67 2e |o "color|"),.e.g.|
|00004750| 20 75 73 69 6e 67 20 74 | 68 65 20 43 6f 6e 74 72 | using t|he Contr|
|00004760| 6f 6c 20 50 61 6e 65 6c | 3a 4d 6f 6e 69 74 6f 72 |ol Panel|:Monitor|
|00004770| 73 2c 20 74 68 65 20 72 | 65 71 75 65 73 74 20 69 |s, the r|equest i|
|00004780| 73 20 70 61 73 73 65 64 | 20 6f 6e 20 74 6f 20 74 |s passed| on to t|
|00004790| 68 65 20 76 69 64 65 6f | 0d 64 72 69 76 65 72 2e |he video|.driver.|
|000047a0| 20 54 68 65 20 76 69 64 | 65 6f 20 64 72 69 76 65 | The vid|eo drive|
|000047b0| 72 20 74 72 61 6e 73 66 | 6f 72 6d 73 20 65 61 63 |r transf|orms eac|
|000047c0| 68 20 6f 66 20 79 6f 75 | 72 20 72 67 62 20 74 72 |h of you|r rgb tr|
|000047d0| 69 70 6c 65 74 73 20 74 | 6f 20 61 0d 6c 75 6d 69 |iplets t|o a.lumi|
|000047e0| 6e 61 6e 63 65 2d 65 71 | 75 69 76 61 6c 65 6e 74 |nance-eq|uivalent|
|000047f0| 20 67 72 61 79 2c 20 75 | 73 69 6e 67 20 61 20 66 | gray, u|sing a f|
|00004800| 6f 72 6d 75 6c 61 20 74 | 68 61 74 20 6d 75 73 74 |ormula t|hat must|
|00004810| 20 62 65 20 76 65 72 79 | 20 73 69 6d 69 6c 61 72 | be very| similar|
|00004820| 2c 20 69 66 20 6e 6f 74 | 0d 65 71 75 69 76 61 6c |, if not|.equival|
|00004830| 65 6e 74 2c 20 74 6f 20 | 74 68 65 20 63 6f 64 65 |ent, to |the code|
|00004840| 20 62 65 6c 6f 77 2e 20 | 54 68 65 20 72 6f 75 6e | below. |The roun|
|00004850| 64 69 6e 67 20 69 73 20 | 62 61 64 2c 20 65 2e 67 |ding is |bad, e.g|
|00004860| 2e 20 61 6e 79 20 67 72 | 61 79 20 72 67 62 20 74 |. any gr|ay rgb t|
|00004870| 72 69 70 6c 65 74 0d 28 | 69 2c 69 2c 69 29 2c 20 |riplet.(|i,i,i), |
|00004880| 6f 74 68 65 72 20 74 68 | 61 6e 20 28 30 2c 30 2c |other th|an (0,0,|
|00004890| 30 29 2c 20 69 73 20 74 | 72 61 6e 73 66 6f 72 6d |0), is t|ransform|
|000048a0| 65 64 20 74 6f 20 28 69 | 2d 31 2c 69 2d 31 2c 69 |ed to (i|-1,i-1,i|
|000048b0| 2d 31 29 2c 20 77 68 69 | 63 68 20 69 73 20 64 61 |-1), whi|ch is da|
|000048c0| 72 6b 65 72 2c 0d 66 61 | 69 6c 69 6e 67 20 74 6f |rker,.fa|iling to|
|000048d0| 20 70 72 65 73 65 72 76 | 65 20 6c 75 6d 69 6e 61 | preserv|e lumina|
|000048e0| 6e 63 65 2e 20 48 6f 77 | 65 76 65 72 2c 20 6d 79 |nce. How|ever, my|
|000048f0| 20 67 6f 61 6c 20 77 61 | 73 20 74 6f 20 72 65 70 | goal wa|s to rep|
|00004900| 6c 69 63 61 74 65 20 41 | 70 70 6c 65 27 73 20 63 |licate A|pple's c|
|00004910| 72 75 6d 62 79 0d 74 72 | 61 6e 73 66 6f 72 6d 61 |rumby.tr|ansforma|
|00004920| 74 69 6f 6e 2c 20 6e 6f | 74 20 74 6f 20 69 6d 70 |tion, no|t to imp|
|00004930| 72 6f 76 65 20 69 74 2e | 20 49 20 70 72 65 73 75 |rove it.| I presu|
|00004940| 6d 65 20 74 68 61 74 20 | 74 68 65 20 72 65 61 73 |me that |the reas|
|00004950| 6f 6e 20 74 68 61 74 20 | 49 20 68 61 76 65 20 74 |on that |I have t|
|00004960| 6f 20 74 72 69 6d 0d 6d | 79 20 6e 75 6d 62 65 72 |o trim.m|y number|
|00004970| 73 20 64 6f 77 6e 20 61 | 20 74 61 64 20 28 2d 30 |s down a| tad (-0|
|00004980| 2e 30 30 30 30 31 29 20 | 69 73 20 74 68 61 74 20 |.00001) |is that |
|00004990| 49 27 6d 20 64 6f 69 6e | 67 20 74 68 69 73 20 77 |I'm doin|g this w|
|000049a0| 69 74 68 20 38 30 2d 62 | 69 74 20 70 72 65 63 69 |ith 80-b|it preci|
|000049b0| 73 69 6f 6e 0d 77 68 65 | 72 65 61 73 20 74 68 65 |sion.whe|reas the|
|000049c0| 20 64 72 69 76 65 72 20 | 75 73 65 73 20 74 68 65 | driver |uses the|
|000049d0| 20 36 34 2d 62 69 74 20 | 70 72 65 63 69 73 69 6f | 64-bit |precisio|
|000049e0| 6e 20 6f 66 20 74 68 65 | 20 53 41 4e 45 20 72 6f |n of the| SANE ro|
|000049f0| 75 74 69 6e 65 73 2e 20 | 50 72 65 73 75 6d 61 62 |utines. |Presumab|
|00004a00| 6c 79 20 49 0d 63 6f 75 | 6c 64 20 6f 62 74 61 69 |ly I.cou|ld obtai|
|00004a10| 6e 20 74 68 65 20 73 61 | 6d 65 20 72 65 73 75 6c |n the sa|me resul|
|00004a20| 74 20 62 79 20 63 6f 6d | 70 69 6c 69 6e 67 20 74 |t by com|piling t|
|00004a30| 68 69 73 20 73 75 62 72 | 6f 75 74 69 6e 65 20 73 |his subr|outine s|
|00004a40| 65 70 61 72 61 74 65 6c | 79 2c 20 74 6f 20 75 73 |eparatel|y, to us|
|00004a50| 65 0d 36 34 2d 62 69 74 | 20 66 6c 6f 61 74 69 6e |e.64-bit| floatin|
|00004a60| 67 20 70 6f 69 6e 74 2c | 20 73 69 6e 63 65 20 61 |g point,| since a|
|00004a70| 6c 6c 20 74 68 65 20 61 | 72 67 75 6d 65 6e 74 73 |ll the a|rguments|
|00004a80| 20 61 72 65 20 69 6e 74 | 73 2e 0d 2a 2f 0d 76 6f | are int|s..*/.vo|
|00004a90| 69 64 20 52 47 42 54 6f | 47 72 61 79 28 52 47 42 |id RGBTo|Gray(RGB|
|00004aa0| 43 6f 6c 6f 72 20 2a 72 | 67 62 2c 73 68 6f 72 74 |Color *r|gb,short|
|00004ab0| 20 64 61 63 53 69 7a 65 | 29 0d 2f 2f 20 45 6d 70 | dacSize|).// Emp|
|00004ac0| 69 72 69 63 61 6c 20 66 | 6f 72 6d 75 6c 61 20 74 |irical f|ormula t|
|00004ad0| 6f 20 72 65 70 6c 69 63 | 61 74 65 20 41 70 70 6c |o replic|ate Appl|
|00004ae0| 65 27 73 20 6c 75 6d 69 | 6e 61 6e 63 65 20 6d 61 |e's lumi|nance ma|
|00004af0| 70 70 69 6e 67 2e 0d 7b | 0d 09 73 68 6f 72 74 20 |pping..{|..short |
|00004b00| 69 2c 73 68 69 66 74 3b | 0d 09 75 6e 73 69 67 6e |i,shift;|..unsign|
|00004b10| 65 64 20 6c 6f 6e 67 20 | 6e 3b 0d 09 0d 09 69 66 |ed long |n;....if|
|00004b20| 28 21 53 69 78 74 65 65 | 6e 42 69 74 47 72 61 79 |(!Sixtee|nBitGray|
|00004b30| 29 7b 0d 09 09 73 68 69 | 66 74 3d 31 36 2d 64 61 |){...shi|ft=16-da|
|00004b40| 63 53 69 7a 65 3b 0d 09 | 09 69 3d 28 72 67 62 2d |cSize;..|.i=(rgb-|
|00004b50| 3e 72 65 64 3e 3e 73 68 | 69 66 74 29 2a 28 30 2e |>red>>sh|ift)*(0.|
|00004b60| 33 30 2d 30 2e 30 30 30 | 30 31 29 0d 09 09 09 2b |30-0.000|01)....+|
|00004b70| 28 72 67 62 2d 3e 67 72 | 65 65 6e 3e 3e 73 68 69 |(rgb->gr|een>>shi|
|00004b80| 66 74 29 2a 28 30 2e 35 | 39 2d 30 2e 30 30 30 30 |ft)*(0.5|9-0.0000|
|00004b90| 31 29 2b 28 72 67 62 2d | 3e 62 6c 75 65 3e 3e 73 |1)+(rgb-|>blue>>s|
|00004ba0| 68 69 66 74 29 2a 28 30 | 2e 31 31 29 3b 0d 09 09 |hift)*(0|.11);...|
|00004bb0| 6e 3d 30 78 66 66 66 66 | 66 66 66 66 55 4c 2f 28 |n=0xffff|ffffUL/(|
|00004bc0| 28 31 3c 3c 64 61 63 53 | 69 7a 65 29 2d 31 29 3b |(1<<dacS|ize)-1);|
|00004bd0| 0d 09 09 72 67 62 2d 3e | 72 65 64 3d 72 67 62 2d |...rgb->|red=rgb-|
|00004be0| 3e 67 72 65 65 6e 3d 72 | 67 62 2d 3e 62 6c 75 65 |>green=r|gb->blue|
|00004bf0| 3d 28 69 2a 6e 29 3e 3e | 31 36 3b 0d 09 7d 65 6c |=(i*n)>>|16;..}el|
|00004c00| 73 65 7b 0d 09 09 72 67 | 62 2d 3e 72 65 64 3d 72 |se{...rg|b->red=r|
|00004c10| 67 62 2d 3e 67 72 65 65 | 6e 3d 72 67 62 2d 3e 62 |gb->gree|n=rgb->b|
|00004c20| 6c 75 65 3d 72 67 62 2d | 3e 72 65 64 2a 28 30 2e |lue=rgb-|>red*(0.|
|00004c30| 33 30 2d 30 2e 30 30 30 | 30 31 29 0d 09 09 09 2b |30-0.000|01)....+|
|00004c40| 72 67 62 2d 3e 67 72 65 | 65 6e 2a 28 30 2e 35 39 |rgb->gre|en*(0.59|
|00004c50| 29 2b 72 67 62 2d 3e 62 | 6c 75 65 2a 28 30 2e 31 |)+rgb->b|lue*(0.1|
|00004c60| 31 2d 30 2e 30 30 30 30 | 31 29 3b 0d 09 7d 0d 7d |1-0.0000|1);..}.}|
|00004c70| 0d 0d 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004c80| 00 00 01 00 00 00 06 2c | 00 00 05 2c 00 00 00 9e |.......,|...,....|
|00004c90| 65 73 73 28 74 68 65 54 | 72 61 70 2c 20 74 54 79 |ess(theT|rap, tTy|
|00004ca0| 70 65 29 20 21 3d 20 4e | 47 65 74 54 72 61 70 41 |pe) != N|GetTrapA|
|00004cb0| 0c 47 44 54 65 73 74 43 | 6c 75 74 2e 63 7c 02 00 |.GDTestC|lut.c|..|
|00004cc0| 00 00 50 61 72 74 53 49 | 54 21 00 00 00 00 00 00 |..PartSI|T!......|
|00004cd0| 00 00 50 61 72 74 53 49 | 54 21 00 00 00 00 00 00 |..PartSI|T!......|
|00004ce0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004cf0| 00 00 ab bf ee 5d 00 00 | 00 00 00 00 06 ca 61 70 |.....]..|......ap|
|00004d00| 41 64 64 72 65 73 73 28 | 5f 49 6e 69 74 47 72 61 |Address(|_InitGra|
|00004d10| 66 2c 20 54 6f 6f 6c 54 | 72 61 70 29 20 3d 3d 20 |f, ToolT|rap) == |
|00004d20| 4e 47 65 74 54 72 61 70 | 41 64 64 72 65 73 73 28 |NGetTrap|Address(|
|00004d30| 30 78 41 41 36 45 2c 54 | 6f 6f 6c 54 72 61 70 29 |0xAA6E,T|oolTrap)|
|00004d40| 29 0d 09 09 72 65 74 75 | 72 6e 20 30 78 30 32 30 |)...retu|rn 0x020|
|00004d50| 30 3b 0d 09 65 6c 73 65 | 0d 09 09 72 65 74 75 72 |0;..else|...retur|
|00004d60| 6e 20 30 78 30 34 30 30 | 3b 0d 7d 0d 0d 0d 54 72 |n 0x0400|;.}...Tr|
|00004d70| 61 70 54 79 70 65 20 47 | 65 74 54 72 61 70 54 79 |apType G|etTrapTy|
|00004d80| 00 00 00 14 00 00 14 af | ff ff 00 00 00 00 00 00 |........|........|
|00004d90| 22 41 ff ff 00 00 00 00 | 00 00 01 52 00 0b 00 16 |"A......|...R....|
|00004da0| 00 00 35 ed 01 95 00 e8 | 0d bc 00 00 07 66 72 61 |..5.....|.....fra|
|00004db0| 6d 65 73 20 00 16 00 00 | 35 ed 01 95 00 e8 0d ac |mes ....|5.......|
|00004dc0| 00 00 07 73 2a 31 30 30 | 30 2e 00 1c 00 00 35 ed |...s*100|0.....5.|
|00004dd0| 01 95 00 e8 0d 90 00 00 | 0d 6d 69 73 73 69 6e 67 |........|.missing|
|00004de0| 46 72 61 6d 65 73 00 18 | 00 00 35 ed 01 95 00 e8 |Frames..|..5.....|
|00004df0| 0d 80 00 00 09 66 72 61 | 6d 65 52 61 74 65 00 30 |.....fra|meRate.0|
|00004e00| 00 00 35 ed 01 95 00 e8 | 0d 70 80 00 01 33 03 f1 |..5.....|.p...3..|
|00004e10| 01 dc 04 c6 94 20 00 00 | 00 00 00 00 11 28 2a 63 |..... ..|.....(*c|
|00004e20| 61 72 64 29 2e 64 65 70 | 74 68 5b 33 5d 20 00 1c |ard).dep|th[3] ..|
|00004e30| 00 00 35 ed 01 95 00 e8 | 0c f0 00 00 0d 28 2a 63 |..5.....|.....(*c|
|00004e40| 61 72 64 29 2e 64 65 70 | 74 68 00 30 00 00 35 ed |ard).dep|th.0..5.|
|00004e50| 01 95 00 e8 0c e0 80 00 | 01 07 02 b9 01 dc 03 b7 |........|........|
|00004e60| 94 20 00 00 00 00 00 03 | 00 01 00 02 00 04 00 40 |. ......|.......@|
|00004e70| 00 0a 00 02 05 2a 63 61 | 72 64 00 14 00 00 35 ed |.....*ca|rd....5.|
|00004e80| 01 95 00 e8 0c 44 00 00 | 05 63 61 72 64 20 00 30 |.....D..|.card .0|
|00004e90| 00 00 35 ed 01 95 00 e8 | 0c 34 80 00 01 28 02 d5 |..5.....|.4...(..|
|00004ea0| 01 dc 03 a5 94 20 00 00 | 00 00 00 00 11 28 2a 63 |..... ..|.....(*c|
|00004eb0| 61 72 64 29 2e 64 65 70 | 74 68 5b 30 5d 20 00 16 |ard).dep|th[0] ..|
|00004ec0| 00 00 35 ed 01 95 00 e8 | 0b 50 00 00 07 63 61 72 |..5.....|.P...car|
|00004ed0| 64 2d 3e 6d 00 1a 00 00 | 35 ed 01 95 00 e8 0b 20 |d->m....|5...... |
|00004ee0| 10 02 0b 63 61 72 64 2d | 3e 6d 6f 64 65 20 00 00 |...card-|>mode ..|
|00004ef0| 00 1e 00 3c 00 24 01 8d | 02 3d 00 3c 00 24 01 8d |...<.$..|.=.<.$..|
|00004f00| 02 3d 00 00 08 0b 00 00 | 00 00 00 00 00 00 00 00 |.=......|........|
|00004f10| 00 00 00 14 00 00 16 a7 | 00 9c 00 00 00 00 00 00 |........|........|
|00004f20| 10 60 00 65 00 00 00 00 | 00 00 02 02 00 11 00 18 |.`.e....|........|
|00004f30| 00 00 0f d2 00 60 00 55 | 88 7c 00 00 09 63 6c 75 |.....`.U|.|...clu|
|00004f40| 74 53 69 7a 65 20 00 18 | 00 00 13 e4 00 87 00 55 |tSize ..|.......U|
|00004f50| 88 6c 00 00 09 74 61 62 | 6c 65 53 69 7a 65 00 1e |.l...tab|leSize..|
|00004f60| 00 00 13 7d 00 83 00 55 | 87 e4 00 00 0f 28 2a 70 |...}...U|.....(*p|
|00004f70| 75 74 54 61 62 6c 65 29 | 2e 72 67 62 00 18 00 00 |utTable)|.rgb....|
|00004f80| 13 7d 00 83 00 55 88 88 | 00 00 09 2a 70 75 74 54 |.}...U..|...*putT|
|00004f90| 61 62 6c 65 00 18 00 00 | 13 7d 00 83 00 55 88 84 |able....|.}...U..|
|00004fa0| 00 00 09 70 75 74 54 61 | 62 6c 65 20 00 2e 00 00 |...putTa|ble ....|
|00004fb0| 14 3c 00 89 00 55 88 a8 | 80 00 00 89 01 c5 00 f0 |.<...U..|........|
|00004fc0| 02 7b 94 20 00 00 00 00 | 00 00 0f 70 75 74 54 61 |.{. ....|...putTa|
|00004fd0| 62 6c 65 5b 31 5d 2e 72 | 67 62 00 1e 00 00 13 7d |ble[1].r|gb.....}|
|00004fe0| 00 83 00 55 87 a8 00 00 | 0f 67 65 74 54 61 62 6c |...U....|.getTabl|
|00004ff0| 65 5b 31 5d 2e 72 67 62 | 00 18 00 00 13 7d 00 83 |e[1].rgb|.....}..|
|00005000| 00 55 87 ac 00 00 09 2a | 67 65 74 54 61 62 6c 65 |.U.....*|getTable|
|00005010| 00 18 00 00 13 7d 00 83 | 00 55 87 a4 00 00 09 67 |.....}..|.U.....g|
|00005020| 65 74 54 61 62 6c 65 20 | 00 18 00 00 14 83 00 8b |etTable |........|
|00005030| 00 55 88 5c 00 00 09 74 | 61 62 6c 65 53 69 7a 65 |.U.\...t|ableSize|
|00005040| 00 18 00 00 14 f4 00 90 | 00 55 85 94 10 02 09 70 |........|.U.....p|
|00005050| 75 74 53 75 6d 5b 30 5d | 00 26 00 00 14 f4 00 90 |utSum[0]|.&......|
|00005060| 00 55 86 f8 40 00 00 b1 | 01 cd 01 4f 02 87 94 20 |.U..@...|...O... |
|00005070| 00 00 00 00 00 02 07 70 | 75 74 53 75 6d 20 00 16 |.......p|utSum ..|
|00005080| 00 00 15 0e 00 92 00 55 | 86 b4 00 00 07 67 65 74 |.......U|.....get|
|00005090| 53 75 6d 20 00 30 00 00 | 15 d0 00 98 00 55 86 60 |Sum .0..|.....U.`|
|000050a0| 40 00 00 d6 00 2d 01 b6 | 00 e6 94 20 00 00 00 00 |@....-..|... ....|
|000050b0| 00 80 11 63 6c 75 74 2d | 3e 72 67 62 47 61 69 6e |...clut-|>rgbGain|
|000050c0| 5b 30 5d 20 00 2c 00 00 | 15 d0 00 98 00 55 86 f4 |[0] .,..|.....U..|
|000050d0| 40 00 00 9d 01 c9 01 7d | 02 82 94 20 00 00 00 00 |@......}|... ....|
|000050e0| 00 10 0d 63 6c 75 74 2d | 3e 72 67 62 47 61 69 6e |...clut-|>rgbGain|
|000050f0| 00 28 00 00 15 d0 00 98 | 00 55 85 24 40 00 00 d6 |.(......|.U.$@...|
|00005100| 01 00 01 b6 01 b9 94 20 | 00 00 00 00 00 02 09 67 |....... |.......g|
|00005110| 65 74 53 75 6d 5b 30 5d | 00 16 00 00 15 d0 00 98 |etSum[0]|........|
|00005120| 00 55 85 b0 00 00 07 67 | 65 74 53 75 6d 20 00 00 |.U.....g|etSum ..|
|00005130| 01 26 00 0c 00 00 1a 83 | 00 00 1a 96 13 43 6f 6d |.&......|.....Com|
|00005140| 70 75 74 65 52 4d 53 43 | 6c 75 74 45 72 72 6f 72 |puteRMSC|lutError|
|00005150| 00 00 12 e3 00 00 12 f8 | 15 45 73 74 69 6d 61 74 |........|.Estimat|
|00005160| 65 43 6c 75 74 54 72 61 | 6e 73 66 6f 72 6d 00 00 |eClutTra|nsform..|
|00005170| 41 16 00 00 41 2c 17 47 | 44 52 65 73 74 6f 72 65 |A...A,.G|DRestore|
|00005180| 42 6c 61 63 6b 41 6e 64 | 57 68 69 74 65 00 00 00 |BlackAnd|White...|
|00005190| 0c a1 00 00 0c ab 0b 47 | 44 54 65 73 74 43 6c 75 |.......G|DTestClu|
|000051a0| 74 00 00 00 39 99 00 00 | 39 a7 0f 47 44 54 65 73 |t...9...|9..GDTes|
|000051b0| 74 43 6c 75 74 48 61 73 | 68 00 00 00 29 88 00 00 |tClutHas|h...)...|
|000051c0| 29 9a 13 47 44 54 65 73 | 74 43 6c 75 74 56 69 73 |)..GDTes|tClutVis|
|000051d0| 75 61 6c 6c 79 00 00 00 | 31 bd 00 00 31 ca 0d 4d |ually...|1...1..M|
|000051e0| 61 6b 65 43 6c 75 74 54 | 61 62 6c 65 00 00 47 7b |akeClutT|able..G{|
|000051f0| 00 00 47 84 09 52 47 42 | 54 6f 47 72 61 79 00 00 |..G..RGB|ToGray..|
|00005200| 43 3c 00 00 43 4c 11 55 | 6e 65 71 75 61 6c 43 6c |C<..CL.U|nequalCl|
|00005210| 75 74 45 6e 74 72 79 00 | 00 00 3b e2 00 00 3b ed |utEntry.|..;...;.|
|00005220| 0b 56 69 73 69 62 6c 65 | 48 61 73 68 00 00 17 3f |.Visible|Hash...?|
|00005230| 00 00 17 4f 11 57 72 69 | 74 65 41 6e 64 52 65 61 |...O.Wri|teAndRea|
|00005240| 64 43 6c 75 74 00 00 00 | 36 b3 00 00 36 bc 09 57 |dClut...|6...6..W|
|00005250| 72 69 74 65 43 6c 75 74 | 00 00 00 48 00 09 4d 6f |riteClut|...H..Mo|
|00005260| 6e 61 63 6f 00 00 00 00 | 00 00 00 00 00 00 00 00 |naco....|........|
|00005270| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 03 |........|........|
|00005280| 00 04 00 3d 00 03 01 8c | 02 7d 00 3d 00 03 01 8c |...=....|.}.=....|
|00005290| 02 7d ab ad ab 71 00 00 | 09 79 00 00 09 7c 00 00 |.}...q..|.y...|..|
|000052a0| 06 9c 00 00 00 00 00 04 | 00 01 00 01 00 00 01 00 |........|........|
|000052b0| 00 00 06 2c 00 00 05 2c | 00 00 00 9e 00 5a 47 b4 |...,...,|.....ZG.|
|000052c0| 21 0e 00 00 00 1c 00 9e | 00 03 42 4b 50 54 00 01 |!.......|..BKPT..|
|000052d0| 00 22 44 54 56 55 00 01 | 00 3a 4d 50 53 52 00 02 |."DTVU..|.:MPSR..|
|000052e0| 00 52 4d 57 42 42 00 00 | 00 76 34 1c ff ff 00 00 |.RMWBB..|.v4.....|
|000052f0| 00 00 00 00 00 00 44 b3 | ff ff 00 00 01 90 00 00 |......D.|........|
|00005300| 00 00 62 7e ff ff 00 00 | 00 18 00 00 00 00 0f 1f |..b~....|........|
|00005310| ff ff 00 00 01 a8 00 00 | 00 00 03 f0 ff ff 00 00 |........|........|
|00005320| 01 6e 00 00 00 00 03 ef | ff ff 00 00 03 ae 00 00 |.n......|........|
|00005330| 00 00 03 ed ff ff 00 00 | 04 d8 00 00 00 00 03 f0 |........|........|
|00005340| ff ff 00 00 05 24 00 00 | 00 00 00 00 00 00 00 00 |.....$..|........|
|00005350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+